学习分享之成绩排优良
- #include <stdio.h>
- int main(int argc, const char * argv[]) {
- //1.先定义变量。
- int score=0;
- //2.提示用户输入分数,并保存用户输入分数
- printf("请输入你的分数:\n");
- scanf("%d",&score);
- //3.判断
- if(score<0||score>100){
- printf("请不要乱来啊,亲!");
- return 0;
- }
- int s=score/10;
- switch (s) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- printf("E\n");
- break;
- case 6:
- printf("D\n");
- break;
- case 7:
- printf("C\n");
- break;
- case 8:
- printf("B\n");
- break;
- case 9:
- case 10:
- printf("A\n");
- break;
- default:
- break;
- }
-
-
-
-
- return 0;
- }
复制代码
|
|