1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 08:26:20 +00:00
202401-programming-assignments/【实践课外】3.选择结构2/7-4 C程序设计 实验2-2-2成绩转换(switch).c

37 lines
605 B
C
Raw Permalink Normal View History

2024-10-23 03:12:50 +00:00
#include <stdio.h>
int main() {
int score;
scanf("%d", &score);
switch (score / 10) {
case 10:
case 9:
printf("A\n");
break;
case 8:
printf("B\n");
break;
case 7:
printf("C\n");
break;
case 6:
printf("D\n");
break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
printf("E\n");
break;
default:
printf("Input error!\n");
break;
}
return 0;
}