返回列表 發帖
  1. import java.util.Scanner;


  2. public class sdf {

  3.         public static void main(String[] args) {
  4.                 while (true)
  5.                 {
  6.                         Scanner s=new Scanner(System.in);
  7.                         float str;
  8.                         System.out.println("請輸入你的成績:");
  9.                         str=s.nextFloat();
  10.                         if(str>=90&&str<=100)
  11.                                 System.out.print("優");
  12.                         else if(str>=80&&str<=89)
  13.                                 System.out.print("甲");
  14.                         else if(str>=70&&str<79)
  15.                                 System.out.print("乙");
  16.                         else if(str>=60&&str<=69)
  17.                                 System.out.print("丙");
  18.                         else if(str>=0&&str<=60)
  19.                                 System.out.print("丁");
  20.                         else
  21.                                 System.out.print("輸入錯誤!");
  22.                         System.out.println(str+"\n");
  23.                 }
  24.         }

  25. }
複製代碼

TOP

返回列表