- public class Ch03
- {
- public static void main(String[] args)
- {
- int avg;
- String a[]={"座號","姓名","國文","英文","數學","平均"};
- String b[]={"小叮噹","大雄","宜靜","技安","阿福"};
- int c[][]={{90,85,85},
- {70,75,80},
- {80,95,80},
- {70,95,75},
- {80,85,95}};
- for(int i=0; i<=5; i++)
- System.out.print(a[i]+"\t");
- System.out.println();
- System.out.println("=========================================================");
- for(int i=0; i<=4; i++)
- {
- System.out.print((i+1)+"\t"+b[i]+"\t");
- for(int j=0; j<3; j++)
- System.out.print(c[i][j]+"\t");
- avg=(c[i][0]+c[i][1]+c[i][2])/3;
- System.out.println(avg);
- }
- }
- }
複製代碼 |