返回列表 發帖
  1. public class CH01
  2. {
  3.     public static void main(String args[])
  4.     {
  5.             String title[]={"座號","姓名","國文","英文","數學","平均"};
  6.             String name[]={"小叮噹","大雄","宜靜","技安","阿福"};
  7.             int score[][]={{99,100,96},{11,5,3},{91,89,95},{53,45,58},{77,78,82}};
  8.             float a;
  9.         for(int i=0;i<6;i++)
  10.                 System.out.print(title[i]+"\t");
  11.         System.out.println();
  12.         System.out.println("===========================================");
  13.         for(int i=0;i<5;i++)
  14.         {
  15.                 a=(float)(Math.round(score[i][0]+score[i][1]+score[i][2])/3);
  16.                 System.out.print((i+1)+"\t"+name[i]+"\t");
  17.                 for(int j=0;j<3;j++)
  18.                 {
  19.                 System.out.print(score[i][j]+"\t");
  20.                 }
  21.             System.out.println(a);               
  22.         }           
  23.     }
  24. }
複製代碼

TOP

返回列表