给出一百分制成绩,要求输出成绩等级’A’、’B’、’C’、’D’、’E’。

时间:2023-03-08 22:10:53
import java.util.Scanner;

public class test5 {

    public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("请输入成绩:");
int score=sc.nextInt();
if(score>=90&&score<=100){ System.out.println("你的成绩等级为:A"); }if(score>=80&&score<=89){ System.out.println("你的成绩等级为:B"); }
if(score>=70&&score<=79){ System.out.println("你的成绩等级为:C"); }
if(score>=60&&score<=69){ System.out.println("你的成绩等级为:D"); }if(score>=0&&score<60){ System.out.println("你的成绩等级为:E"); }else{
System.out.println("考试成绩输入有误"); } }
}