문제 설명 

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

  • 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;
}

'백준 > 조건문' 카테고리의 다른 글

2525: 오븐 시계 / C++  (0) 2023.03.07
2884: 알람 시계 / C++  (0) 2023.03.07
14861: 사분면 고르기 / C++  (0) 2023.03.07
2753: 윤년 / C++  (0) 2023.03.07
1330: 두 수 비교하기 / C++  (0) 2023.03.07

+ Recent posts