标签:
//输入10人的分数,求排序最高分,最低分,平均分, Console.WriteLine("请输入10位同学的成绩:"); int[]fenshu=new int [10]; double ave = 0; double sum = 0; int min = 0; int max = 0; for (int i = 0; i < 10; i++) { fenshu[i] = int.Parse(Console .ReadLine ()); sum =sum +fenshu [i]; if (i == 0) { min=fenshu [0]; max =fenshu [0];} else { if( min >fenshu [i ]) min =fenshu [i]; if (max<fenshu [i]) max =fenshu [i]; } ave = sum / 10; } Console.Write("ave=" + ave +"\n"); Console.Write("sum=" + sum + "\n"); Console.Write("max=" + max + "\n"); Console.Write("min=" + min + "\n"); Console.ReadLine();
标签:
原文地址:http://www.cnblogs.com/cf924823/p/4816622.html