- package text369;
- import java.lang.System;
- import java.util.Scanner;
- public class text123 {
- public static void main(String[] args) {
- float x;
- Scanner s=new Scanner(System.in);
- System.out.println("請輸入你的成績:");
- x=s.nextFloat();
- if(x>=90 && x<=100)
- {
- System.out.print("優");
- }
- else if(x>=80 && x<90)
- {
- System.out.print("甲");
- }
- else if(x>=70 && x<80)
- {
- System.out.print("乙");
- }
- else if(x>=60 && x<70)
- {
- System.out.print("丙");
- }
- else if(x>=0 && x<60)
- {
- System.out.print("丁");
- }
- else
- {
- System.out.print("輸入錯誤");
- }
- }
- }
複製代碼 |