//多维数组
private static void fun23() {
double [][] a=new double[3][];
a[0]=new double[2];
a[1]=new double[3];
a[2]=new double[2];
Scanner sc=new Scanner(System.in);
for(int i=0;i<a.length;i++){
int sum=0;
for(int j=0;j<a[i].length;j++){
System.out.println("请输入第"+(i+1)+"个班的第"+(j+1)+"个学员的成绩:");
a[i][j]=sc.nextDouble();
sum+=a[i][j];
}
System.out.println("第"+(i+1)+"个班级的总成绩是:"+sum);
}
}
网友评论