天天看點

HDOJ2004成績轉換成績轉換

成績轉換

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 70452    Accepted Submission(s): 30852

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

#include<stdio.h>
int main()
{
    int n;
    while(scanf("%d", &n) == 1)
    {
       if(n>=90&&n<=100)
        printf("A\n");
       if(n>=80&&n<=89)
        printf("B\n");
       if(n>=70&&n<=79)
        printf("C\n");
       if(n>=60&&n<=69)
        printf("D\n");
       if(n>=0&&n<=59)
        printf("E\n");
       if(n<0||n>100)
        printf("Score is error!\n");
    }
    return 0;
}      

轉載于:https://www.cnblogs.com/la0bei/p/3649234.html