int [ ] points = {18,25,7,36,13,2,89,63};
int min = points[0];
int index = 0;
for (int i = 0; i < points.Length; i++)
{
if (min > points[i])
{
min=points[i];
index = i+1;
}
}
Console.WriteLine("最小值:{0} 下标:{1}", min,index);
Console.ReadKey();
#效果
网友评论