Grade Calculator

Lab C++ Beginner 10 points

Read a score 0–100 and print A (90+), B (80+), C (70+), D (60+) or F.

Input

One integer.

Output

One letter.

Example

Input

95

Output

A
Sample input available Sample output available
Editor
C++

Hints

Check from the top band down.

Solution explanation

An else if chain stops at the first matching condition.

Show solution
#include <iostream>
using namespace std;

int main() {
    int s;
    cin >> s;
    char grade;
    if (s >= 90) grade = 'A';
    else if (s >= 80) grade = 'B';
    else if (s >= 70) grade = 'C';
    else if (s >= 60) grade = 'D';
    else grade = 'F';
    cout << grade << "\n";
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD