string[] name = new string[2]; int[] score = new int[2]; for (int i = 0; i < name.Length; i++) { Console.Write("请输入第" + (i + 1) + "名的姓名:"); name[i] = Console.ReadLine(); Console.Write("请输入第" + (i + 1) + "名的分数:"); score[i] = int.Parse(Console.ReadLine()); } int sum = 0, avg; int j = 0; for (int i = 0; i < score.Length; i++) { { sum += score[i]; } avg = sum /( score.Length); { if (score[i] > avg) j = i; } score[i] = avg; Console.Write("平均值:{0}高于平均值的同学:{1}", avg, name[i]);
1 回答
- 1 回答
- 0 关注
- 1171 浏览
添加回答
举报
0/150
提交
取消