java 多重循环

时间:2021-11-22 16:04:38
 //http://www.weixueyuan.net/view/6311.html
//多重循环
import java.util.Scanner;
public class Test16{
public static void main(String args[]){
Scanner in =new Scanner(System.in);
for (int i=1;i<=3;i++){ //最外层循环
int sum=0;
for (int j=1;j<=3;j++){
System.out.println("组别:"+i+","+"成员"+j+":");
int s=in.nextInt();
sum+=s;
}
int avg=sum/3;
System.out.println("第"+i+"平均成绩:"+avg);
}
}
}