(java)输入成绩,判断成绩等级,if语句实现

package it;

import java.util.Scanner;
public class  demo{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入成绩");
        double score = scanner.nextDouble();
        if (score >= 90) {
            System.out.println("您的成绩是A");
        }
        else if (score >= 80) {
            System.out.println("您的成绩是B");
        }
        else if (score >= 70) {
            System.out.println("您的成绩是C");
        }
        else if (score >= 60) {
            System.out.println("您的成绩是D");
        }
        else if (score >= 0){
            System.out.println("您的成绩是E");
        }
    }
}

你可能感兴趣的:(java,idea)