返回列表 發帖
  1. import java.util.Scanner;
  2. public class Ch01{
  3.         public static void main(String args[])
  4.         {
  5.                 while(true)
  6.                 {       
  7.                         Scanner s=new Scanner(System.in);
  8.                         float score;
  9.                         System.out.print("輸入你的成績");
  10.                         score=s.nextFloat();
  11.                         if(score>=90 && score<=100)
  12.                                 System.out.println("優");
  13.                         else if        (score>=80 && score<90)
  14.                                 System.out.println("甲");
  15.                         else if        (score>=70 && score<80)
  16.                                 System.out.println("乙");
  17.                         else if        (score>=60 && score<70)
  18.                                 System.out.println("丙");
  19.                         else if        (score>=0 && score<60)
  20.                                 System.out.println("丁");
  21.                         else
  22.                                 System.out.println("輸入錯誤");
  23.                         System.out.println();
  24.                 }
  25.         }
  26. }
複製代碼

TOP

返回列表