题目:
源码:
package xiaochengxun;
import java.util.Scanner;
public class chengxu {
public static void main(String[]args) {
try (Scanner sc = new Scanner(System.in)) {
int number=sc.nextInt();
if(number<60)
{
System.out.println("不及格");
}else if(number<70)
{
System.out.println("及格");
}else if(number<80)
{
System.out.println("中");
}else if(number<90)
{
System.out.println("良");
}else if(number<100)
{
System.out.println("优");
}else
{
System.out.println("error");
}
}
}
}
结果:
小结:上课给时间让自己编写一个计分小程序,加强了动手能力。
标签:小测,Scanner,System,number,println,课堂,else,out From: https://www.cnblogs.com/yunbianshangdadun/p/16794601.html