1148 - C语言5.10
给定一个百分制的成绩,输出成绩等级’A’、 ’B’、 ’C’、 ’D’、 ’E’。90分以上为’A’,80至89分为’B’,70至79分为’C’,60至69分为’D’,60分一下为’E’。
Input
一个整数score,保证0<=score<=100.
Output
输出score对应的成绩等级。
请注意行尾输出换行。
Examples
Input
88
Output
B
Solution C
#include<stdio.h> int main(){ char c; int score; scanf("%d",&score); if(score>=90) c='A'; else if(score>=80&&score<=89) c='B'; else if(score>=70&&score<=79) c='C'; else if(score>=60&&score<=69) c='D'; else if(score<60) c='E'; printf("%c\n",c); return 0; }
Solution C++
#include <stdio.h> int main() { int score; char level; scanf("%d", &score); if (score >= 90) level = 'A'; else if (score >= 80) level = 'B'; else if (score >= 70) level = 'C'; else if (score >= 60) level = 'D'; else level = 'E'; printf("%c\n", level); return 0; }