Exercise 3-7 of Zhejiang University Edition "C Language Programming (3rd Edition)"

Practice 3-7 Conversion of scores (15 points)

This question requires writing a program to convert a 100-point score into a five-point score. Conversion rules:
90 or greater is divided into A;
less than 90 and greater than or equal to 80 is B;
less than 80 and greater than or equal to 70 is C;
less than 70 and greater than or equal to 60 is D;
less than 60 is E.

Input format:
Input the percentile score that gives an integer in one line.
Output format:
output the corresponding five-point scores in one line.
Sample input:
90
output Example:
A
Author
Shen Rui
unit
Zhejiang University
Code Zhangduxianzhi

16 KB
time limit
400 ms
memory limit
64 MB

#include <stdio.h>


int main(void) {
    
    
    int grade;
    scanf("%d", &grade);
    if (grade >= 90)
        printf("A");
    else if (grade >= 80)
        printf("B");
    else if (grade >= 70)
        printf("C");
    else if (grade >= 60)
        printf("D");
    else
        printf("E");
    return 0;
}

Guess you like

Origin blog.csdn.net/DoMoreSpeakLess/article/details/109348314