某百货商场当日消费积分最高的8名顾客,他们的积分分别是18、25、7、36、13、2、89、63.编写程序找出最低的积分及它在数组中的原始位置。

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();

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容