- import java.io.Console;
- public class a
- {
- public static void main(String args[])
- {
- int x;
- Console c=System.console();
- x=Integer.parseInt(c.readLine("請輸入分數: "));
- if (x<0||x>100)
- System.out.println("錯誤!");
- else if(x>=90)
- System.out.println("優!");
- else if(x>=80)
- System.out.println("甲!");
- else if(x>=70)
- System.out.println("乙!");
- else if(x>=60)
- System.out.println("丙!");
- else if(x<60)
- System.out.println("丁!");
-
- }
- }
複製代碼 |