- public class Ch02
- {
- public static void main(String args[])
- {
- String title[]={"座號","姓名","國文","英文","數學","平均"};
- String name[]={"蔡哥","昊哥","白鴿","帥哥","蝦咪挖哥"};
- int score[][]={{99,99,99},
- {87,87,87},
- {69,69,69},
- {78,78,78},
- {1000,1000,1000}};
- int avg;
-
- for(int i=0; i<6; i++)
- System.out.print(title[i]+"\t");
- System.out.println();
- System.out.println("=============================================");
- for(int i=0; i<5; i++)
- {
- System.out.print((i+1)+"\t"+name[i]+"\t");
- for(int j=0; j<3; j++)
- {
- System.out.print(score[i][j]+"\t");
- }
- avg=Math.round((float)(score[i][0]+score[i][1]+score[i][2])/3);
- System.out.println(avg);
- }
- }
- }
複製代碼 |