某百貨商場當日消費積分最高的8名顧客,他們的積分分別是18居砖、25虹脯、7、36奏候、13循集、2、89蔗草、63.編寫程序找出最低的積分及它在數(shù)組中的原始位置咒彤。
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int min;
int index = 0;
int[] points = { 18, 25, 7, 36, 13, 2, 89, 63 };
for (int i = 0; i <= 7; i++)
{
min = points[0];
if (points[i] < min)
{
min = points[1];
index = i;
}
? ? ? ? }
? ? ? ? Console.WriteLine("最小值為{0},所在的位置{1}",points [ index ],index+1);
? ? ? ? Console.ReadKey();