import java.util.Scanner;
class Score
{
public static void main(String[] args)
{
Scanner a = new Scanner(System.in);
System.out.println("输入成绩");
int score = a.nextInt();
String level;
if(score>=90&&score<=100)
{
level = "A等";
}
else if(score>=80&&score<=90)
{
level = "B等";
}
else if(score>=70&&score<80)
{
level = "C等";
}
else if(score>=60&&score<70)
{
level = "D等";
}
else if(score>=0&&score<60)
{
level = "F等";
}
System.out.println(score+"是"+level);
}
}
不加else,编译不能通过 |
|