12: 成绩转换

12 成绩转换

作者: xxx时间限制: 1S章节: 分支结构

问题描述 :
输入一个百分制的成绩t,将其转换成对应的等级,具体转换规则如下:
90~100为A;
80~89为B;
70~79为C;
60~69为D;
0~59为E;

输入说明 :
输入一个整数。

输出说明 :
输出对应结果,占一行。如果输入数据不在0~100范围内,请输出一行:“Score is error!”。
注意:无多余空格。

输入范例 :
88
输出范例 :
B
代码:

#include <stdio.h>
int main()
{
	int score;
	while (scanf("%d", &score) != EOF)
	{
		if (score > 100 || score < 0)
		{
			printf("Score is error!");
		}
		else if (score >= 90)
		{
			printf("A");
		}
		else if (score >= 80)
		{
			printf("B");
		}
		else if (score >= 70)
		{
			printf("C");
		}
		else if (score >= 60)
		{
			printf("D");
		}
		else
		{
			printf("E");
		}
	}
	return 0;
}
Yesterday is history,tomorrow ismystery,but today is a gift!That why it is called Present!
原文地址:https://www.cnblogs.com/VictorierJwr/p/12245265.html