输入一批学生成绩,以-1作为结束标记。直接得出以下内容如图哦
统计这批学生中不及格(<60)、及格(60-69)、中(70-9)、良(80~89)、优(>90)的人数并求这批学生的平均分。

java编写学生成绩系统做到如图以下功能
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
关注
import java.util.Scanner; public class Demo1 { public static void main(String[] args) { int a=0,b=0,c=0,d=0,e=0; Scanner scanner=new Scanner(System.in); int score; do { score =scanner.nextInt(); if (0<score && score<60){ a++; }else if (60<=score && score<70){ b++; }else if (70<=score && score<80){ c++; }else if (80<=score && score<90){ d++; }else if (90<=score && score<=100){ e++; } }while (score!=-1); System.out.println("不及格的有"+a+"人"); System.out.println("及格的有"+b+"人"); System.out.println("中等的有"+c+"人"); System.out.println("良好的有"+d+"人"); System.out.println("优秀的有"+e+"人"); } }
希望对题主有所帮助!可以的话,帮忙点个采纳!
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用