1 package demo; 2 import java.util.Scanner; 3 4 public class StudentsScore { 5 public static void main(String[] args) { 6 Scanner sc = new Scanner(System.in); 7 while(true) { 8 System.out.print("请输入学生成绩:"); 9 int score; 10 score = sc.nextInt(); 11 if (score <= 100 && score >= 80) { 12 System.out.println("优秀"); 13 }else if(score < 80 && score >= 70) { 14 System.out.println("良好"); 15 }else if(score < 70 && score >=60) { 16 System.out.println("及格"); 17 }else if(score >=0 &&score < 60) { 18 System.out.println("不及格"); 19 }else { 20 System.out.println("输入错误"); 21 } 22 } 23 } 24 }
小小纪念一下
标签:java,第一个,程序,System,else,score,println,out From: https://www.cnblogs.com/bulangdexiong/p/17166898.html