返回列表 發帖
  1. {  
  2.                 String title[]={"座號","姓名","國文","英文","數學","平均"};
  3.                 String name[]={"小叮噹","大雄","宜靜","技安","阿福"};
  4.                 int score[][]={{90,85,85},
  5.                                       {70,75,80},
  6.                                       {80,95,80},
  7.                                       {70,95,81},
  8.                                       {80,85,95}};
  9.                 for(int i=0; i<6; i++)
  10.                         System.out.print(title[i]+"\t");
  11.                 System.out.println("\n==================================================");
  12.                 for(int i=0; i<5; i++)
  13.                 {
  14.                         System.out.print((i+1)+"\t"+name[i]+"\t");
  15.                         for(int j=0; j<3; j++)
  16.                                 System.out.print(score[i][j]+"\t");
  17.                         float avg=(float)(score[i][0]+score[i][1]+score[i][2])/3;
  18.                         System.out.println(avg);
  19.                 }
  20.         }       
  21. }
複製代碼

TOP

返回列表