这样不是更快?少了一个for
string[] name=new string[5];//名字数组
int[] score=new int[5];//分数数组
int sum = 0;
for (int i = 0; i < score.Length; i++)
{
Console.Write("请输入{0}个同学姓名:",i+1);
name[i] = Console.ReadLine();
Console.Write("请输入第{0 }个同学的分数:",i+1);
score[i] = Convert.ToInt32(Console.ReadLine());
sum += score[i];
}
Console.WriteLine("总分为:{0},平均分为{1}",sum,sum/score.Length);
Console.ReadKey();