使用二维数组求平均数
int[,] student_score=new int [4,5]; int temp; for(int i=0;i<=3;i++) { temp=0; for(int j=0;j<=4;j++) { Console.WriteLine ("请输入第{0}个学生的第{1}门功课:",i+1,j+1); student_score[i,j]=int.Parse (Console.ReadLine ()); temp+=student_score[i,j]; } Console.WriteLine ("This student's average of score is"+temp/5); }