1、需求:
键盘输入考试分数,获取考试分数的等级。
2、代码:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#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、输出结果:
复制代码
1
2
3
4请输入你的分数: 60 及格
最后
以上就是悲凉小虾米最近收集整理的关于C语言_if_查询分数等级的全部内容,更多相关C语言_if_查询分数等级内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复