- public class Ch01
- {
- public static void main(String args[])
- {
- String title[]={"座號","姓名","國文","英文","數學","平均"};
- String name[]={"小叮噹","大雄","怡靜","濟安","阿福"};
-
- int score[][]={{78,89,66},
- {77,67,34},
- {90,98,91},
- {57,59,81},
- {45,66,92}};
-
- int avg;
- for(int i=0; i<6; i++)
-
- System.out.print(title[i]+"\t");
- System.out.println();
- System.out.println("=================================================");
- for(int i1=0; i1<5; i1++)
- {
- System.out.print((i1+1)+"\t"+name[i1]+"\t");
- for(int j=0; j<3; j++)
- {
- System.out.print(score[i1][j]+"\t");
- }
- avg=Math.round((float)(score[i1][0]+score[i1][1]+score[i1][2])/3);
- System.out.println(avg);
- }
- }
- }
複製代碼 |