Problem Description
输入一个百分制的成绩 t, 将其转换成对应的等级, 具体转换规则如下:
90~100 为 A;
80~89 为 B;
70~79 为 C;
60~69 为 D;
0~59 为 E;
Input
输入数据有多组, 每组占一行, 由一个整数组成.
Output
对于每组输入数据, 输出一行. 如果输入数据不在 0~100 范围内, 请输出一行:"Score is error!".
- Sample Input
- 56 67 100 123
- Sample Output
- E D A Score is error!
- Author
- lcy
- Source
C 语言程序设计练习 (一)
- Recommend
- JGShining | We have carefully selected several similar problems for you: http://acm.hdu.edu.cn/showproblem.php?pid=2005 http://acm.hdu.edu.cn/showproblem.php?pid=2006 http://acm.hdu.edu.cn/showproblem.php?pid=2008 http://acm.hdu.edu.cn/showproblem.php?pid=2007 http://acm.hdu.edu.cn/showproblem.php?pid=2010
C 语言代码:
- #include<stdio.h>
- int main()
- {
- int n=0;
- while(scanf("%d",&n)!=EOF)
- {
- if(n>100||n<0)
- printf("Score is error!\n");
- else if(n<=100&&n>=90)
- printf("A\n");
- else if(n>=80)
- printf("B\n");
- else if(n>=70)
- printf("C\n");
- else if(n>=60)
- printf("D\n");
- if(n>=0&&n<=59)
- printf("E\n");
- }
- return 0;
- }
来源: http://www.bubuko.com/infodetail-3456655.html