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