代码:
intscore; Scannerscan=newScanner(System.in); System.out.print("请输入成绩:\n"); score=scan.nextInt(); if( score>=80&&score<=100) System.out.print("优"); elseif(score>=60&&score<80) System.out.print("良"); elseSystem.out.print("不及格");
运行结果
intscore; Scannerscan=newScanner(System.in); System.out.print("请输入成绩:\n"); score=scan.nextInt(); if( score>=80&&score<=100) System.out.print("优"); elseif(score>=60&&score<80) System.out.print("良"); elseSystem.out.print("不及格");