返回列表 發帖
  1. public class Ch01
  2. {
  3.         public static void main(String args[])
  4.         {       
  5.                 String title[]={"座號","姓名","國文","英文","數學","平均"};
  6.                 String name[]={"魯夫","索隆","騙人布","娜美","香吉士"};
  7.                 int score[][]={{77,78,55,0},
  8.                                        {54,30,22,0},
  9.                                        {88,90,100,0},
  10.                                        {95,97,81,0},
  11.                                        {50,51,62,0}};

  12.                 for(int a=0;a<6;a++)
  13.                         System.out.print(title[a]+"\t");
  14.                 System.out.println();
  15.                 System.out.println("===============================================");
  16.                 for(int i=0;i<5;i++)
  17.                 {
  18.                         System.out.print((i+1)+"\t");
  19.                         System.out.print(name[i]+"\t");
  20.                         score[i][3]=Math.round((float)+(score[i][0]+score[i][1]+score[i][2])/3);
  21.                         for(int j=0;j<4        ;j++)
  22.                         {
  23.                                 System.out.print(score[i][j]+"\t");
  24.                         }
  25.                           System.out.println();
  26.                 }
  27.         }
  28. }
複製代碼

TOP

返回列表