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

TOP

返回列表