- public class Ch01
- {
- public static void main(String args[])
- {
- String title[]={"座號","姓名","國文","英文","數學","平均"};
- String name[]={"魯夫","索隆","騙人布","娜美","香吉士"};
- int score[][]={{77,78,55,0},
- {54,30,22,0},
- {88,90,100,0},
- {95,97,81,0},
- {50,51,62,0}};
- for(int a=0;a<6;a++)
- System.out.print(title[a]+"\t");
- System.out.println();
- System.out.println("===============================================");
- for(int i=0;i<5;i++)
- {
- System.out.print((i+1)+"\t");
- System.out.print(name[i]+"\t");
- score[i][3]=Math.round((float)+(score[i][0]+score[i][1]+score[i][2])/3);
- for(int j=0;j<4 ;j++)
- {
- System.out.print(score[i][j]+"\t");
- }
- System.out.println();
- }
- }
- }
複製代碼 |