返回列表 發帖
  1. public class Ch03
  2. {
  3.         public static void main(String[] args)
  4.         {
  5.                 int avg;
  6.                 String a[]={"座號","姓名","國文","英文","數學","平均"};
  7.                 String b[]={"小叮噹","大雄","宜靜","技安","阿福"};
  8.                 int c[][]={{90,85,85},
  9.                                    {70,75,80},
  10.                                    {80,95,80},
  11.                                    {70,95,75},
  12.                                    {80,85,95}};
  13.                 for(int i=0; i<=5; i++)
  14.             System.out.print(a[i]+"\t");
  15.                 System.out.println();
  16.                 System.out.println("=========================================================");
  17.                 for(int i=0; i<=4; i++)
  18.                 {
  19.                         System.out.print((i+1)+"\t"+b[i]+"\t");
  20.                         for(int j=0; j<3; j++)
  21.                             System.out.print(c[i][j]+"\t");
  22.                         avg=(c[i][0]+c[i][1]+c[i][2])/3;
  23.                         System.out.println(avg);
  24.                 }
  25.         }

  26. }
複製代碼

TOP

返回列表