- public class Ch01
- {
- public static void main(String args[])
- {
- int score[][]={{90,85,85,97},{70,75,80,85},{80,95,80,77},{70,95,75,98},{80,85,95,86}};
- String school[]={"三明國小","大同國小","七賢國小","河堤國小","鼓山國小"};
- String name[]={"小叮噹","大雄","宜靜","技安","阿福"};
- System.out.println("學校\t姓名\t國文\t英文\t數學\t社會\t平均");
- System.out.println("===========================================================");
- for(int i=0; i<5; i++)
- {
- System.out.print(school[i]+"\t"+name[i]+"\t");
- for(int j=0; j<4; j++)
- System.out.print(score[i][j]+"\t");
- System.out.println((score[i][0]+score[i][1]+score[i][2]+score[i][3])/4);
- }
- }
- }
複製代碼 |