package com.lovo;
import java.util.Scanner;
public class Test07 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] stuNames = { "关羽", "张飞", "赵云", "黄忠", "马超" };
String[] subNames = { "语文", "数学", "英语" };
int[][] scores = new int[stuNames.length][subNames.length];
for (int i = 0; i < scores.length; i++) {
System.out.println("请录入" + stuNames[i] + "的成绩");
for (int j = 0; j < scores[i].length; j++) {
System.out.print("\t" + subNames[j] + ":");
scores[i][j] = sc.nextInt();
}
}
for (int i = 0; i < stuNames.length; i++) {
double sum1 = 0;
for (int j = 0; j < subNames.length; j++) {
sum1 += scores[i][j];
}
System.out.println(stuNames[i] + "的平均数是" + sum1 / scores[i].length);
}
for (int i = 0; i < subNames.length; i++) {
double sum2 = 0;
for (int j = 0; j < stuNames.length;j++) {
sum2 += scores[j][i];
}
System.out.println(subNames[i] + "的平均数" + sum2 / stuNames.length);
}
sc.close();
}
}