import java.util.Scanner;// public class Dome1{ public static void main(String []args ){ Scanner input = new Scanner (System.in ); float score; System.out.print("请输入成绩:"); score = input.nextFloat(); if(score>100||score <=0){//如果score大于100,或者小于等于0时 System.out.print("输入成绩错误!");//则输出 输入成绩错误 } else{//否则进行下面的判断 if(score>=90&&score <=100){ System.out.print("A"); } else if(score >= 80&&score <=90){ System.out.print("B"); } else if(score >=70&&score <=80){ System.out.print("C"); } else if(score >=60&&score <=70){ System.out.print("D"); } else{ System.out.println("不及格!"); } } } }