2黄秋波


私信TA

用户名:dotcpp0735386

访问量:148

签 名:

等  级
排  名 21062
经  验 651
参赛次数 0
文章发表 4
年  龄 0
在职情况 学生
学  校 广东工业大学
专  业

  自我简介:

TA的其他文章

解题思路:

第一种采用if 

                 else if

                 else

注意事项:

q嵌套过程的逻辑判断

参考代码:

#include <stdio.h>


int main(void){

    char degree[] = {'A','B','C','D','E'};

    int score = 0;

    scanf("%d",&score);

    if(score < 60){

        printf("%c",degree[4]);

    }

    else if(score < 90){

        if(score >= 80){

            printf("%c",degree[1]);

            

        }

        else if(score >= 70){

            printf("%c",degree[2]);

        }

        else{

        printf("%c",degree[3]);

        

    }

        

    }

    else{

        printf("%c",degree[0]);

        

    }

    

    return 0;

}


 

0.0分

2 人评分

  评论区