输入班级人数,然后依次输入学员成绩,计算班级学员的平均成绩和总成绩
Console.WriteLine("请输入班级人数");
int people = Convert.ToInt32(Console.ReadLine());
int i =0;
int sum =0;
while (i < people)
{
Console.WriteLine("请输入第{0}个同学的成绩", i+1);
int chengji = Convert.ToInt32(Console.ReadLine());
sum += chengji;
i++;
}
Console.WriteLine("总成绩为{0},平均成绩为{1}", sum, sum / people);
Console.ReadKey();