백준/조건문

9498: 시험 성적 / C++

Koalitsiya 2023. 3. 7. 16:42

문제 설명 

시험 점수를 입력받아 아래와 같이 출력

  • 100 ~ 90점은 A
  • 89 ~ 80점은 B
  • 79 ~ 70점은 C
  • 69 ~ 60점은 D
  • 나머지는 F

풀이

#include <iostream>

using namespace std;

int main() {
    int score;

    cin >> score;

    if (score <= 100 && score >= 90)
        cout << "A" << endl;
    else if (score >= 80)
        cout << "B" << endl;
    else if (score >= 70)
        cout << "C" << endl;
    else if (score >= 60)
        cout << "D" << endl;
    else
        cout << "F" << endl;

    return 0;
}