深深乳狗 2021-04-23 16:51 采纳率: 100%
浏览 16
已采纳

大佬们怎么做呀?[face]monkey2:019.png[/face] 定义数组,存储10个学生

大佬们怎么做呀?[face]monkey2:019.png[/face] 定义数组,存储10个学生的考试成绩68、76、57、66、86、98、72、84、92、95,输出判断等级。 90~100 优秀 80~89 好 70~79 良 60~69 及格 60以下 不及格
  • 写回答

1条回答 默认 最新

  • CSDN专家-lynn 2021-04-23 16:55
    关注
    public static void main(String[] args) {
        int scores[] = new int[]{68,76,57,66,86,98,72,84,92,95};
        for (int i =0;i < scores.length;i++){
            int score = scores[i];
            if(score >= 90){
                System.out.println("优秀");
            }
            if(score >= 80){
                System.out.println("好");
            }
            if(score >= 70){
                System.out.println("良");
            }
            if(score >= 60){
                System.out.println("及格");
            }
            if(score < 60){
                System.out.println("不及格");
            }
        }
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?