java 多重循环

 1 //http://www.weixueyuan.net/view/6311.html
 2 //多重循环
 3 import java.util.Scanner;
 4 public class Test16{
 5     public static void main(String args[]){
 6         Scanner in =new Scanner(System.in);
 7         for (int i=1;i<=3;i++){ //最外层循环
 8             int sum=0;
 9             for (int j=1;j<=3;j++){
10                 System.out.println("组别:"+i+","+"成员"+j+":");
11                 int s=in.nextInt();
12                 sum+=s;
13             }
14             int avg=sum/3;
15             System.out.println("第"+i+"平均成绩:"+avg);
16         }
17     }
18 }

 

posted @ 2015-09-18 23:20  Xiao|Deng  阅读(195)  评论(0编辑  收藏  举报