为什么会运行两次
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]);