C语言入门第十篇,switch语句练习题

xiaoxiao2021-02-28  31

1.编写一个程序,用户输入ABCDE其中一个字母,然后输出A表示90分以上,B表示80到90分,C表示70到80分,D表示60到70分,E表示60分以下。输入对于的字母输出对应的表示内容。

#include<stdio.h> int main() { char score; scanf("%c",&score); switch(score){ case 'A': printf("90分以上\n"); break; case 'B': printf("80到90分\n"); break; case 'C': printf("70到80分\n"); break; case 'D': printf("60到70分\n"); break; case 'E': printf("60分以下\n"); break; default: printf("输入错误\n"); } return 0; }

练习题的答案都在这里:https://github.com/N1neSun/C-code-and-practice

转载请注明原文地址: https://www.6miu.com/read-600112.html

最新回复(0)