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

  27.     }
  28. }
複製代碼

TOP

返回列表