从键盘接收一个成绩,并判断成绩等级小程序
import java.util.Scanner;
class ChengJi
{
public static void main(String[] args)
{
Scanner score = new Scanner(System.in);
System.out.print("请输入成绩");
int x =score.nextInt();
if(x>=90 & x<100)
{
System.out.print("A");
}
else if(x>=80 && x<90)
{
System.out.print("B");
}
else if(x>=70 && x<80)
{
System.out.print("C");
}
else if(x>=60 && x<70)
{
System.out.print("D");
}
else if(x>=0 && x<60)
{
System.out.print("不及格");
}
else
{
System.out.print("成绩有误");
}
}
}
|