返回列表 發帖
  1. public class Ch31 {

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

  23. }
複製代碼

TOP

返回列表