- public class Ch01{
- public static void main(String args[]){
- String subject[]={"座號","姓名","國文","英文","數學","平均"};
- String name[]={"小叮噹","大雄","宜靜","技安","阿福"};
- int n[][]={{90,82,85,0},
- {70,74,80,0},
- {80,98,80,0},
- {70,96,75,0},
- {80,85,95,0}};
- for(int i=0;i<6;i++)
- System.out.print(subject[i]+"\t");
- System.out.println("\n===========================================");
- for(int j=0;j<5;j++){
- System.out.print((j+1)+"\t"+name[j]+"\t");
- n[j][3]=Math.round((float)(n[j][0]+n[j][1]+n[j][2])/3);
- for(int k=0;k<4;k++)
- System.out.print(n[j][k]+"\t");
- System.out.println();
- }
- }
- }
複製代碼 |