我是靠谱客的博主 悲凉小虾米,这篇文章主要介绍C语言_if_查询分数等级,现在分享给大家,希望可以做个参考。

1、需求:
键盘输入考试分数,获取考试分数的等级。
2、代码:

#include <stdio.h>

int main()
{
    float score;
    
    printf("请输入你的分数:n");
    
    scanf("%f",&score);
    
    if (score >= 90 && score <= 100){
        printf("优秀");
    }else if (score >= 80 && score < 90){
        printf("良好");
    }else if (score >= 60 && score < 80){
        printf("及格");
    }else if (score >= 0 && score < 60){
        printf("不及格");
    }else {
        printf("你输入的分数超出范围了");
    }

    return 0;
}

3、输出结果:

请输入你的分数:
60
及格

最后

以上就是悲凉小虾米最近收集整理的关于C语言_if_查询分数等级的全部内容,更多相关C语言_if_查询分数等级内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(129)

评论列表共有 0 条评论

立即
投稿
返回
顶部