Algorithm/Study
[백준 9498번 C++] 시험 성적
congcoding
2020. 4. 28. 19:04
1. 문제 링크
https://www.acmicpc.net/problem/9498
9498번: 시험 성적
시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
2. 문제 설명
if ~ else if ~ else문을 이용하면 됩니다.
3. 소스코드
BOJ 9498번 시험 성적 C++ 풀이입니다.
#include <iostream>
using namespace std;
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int score;
cin >> score;
if (score >= 90) cout << 'A';
else if (score >= 80) cout << 'B';
else if (score >= 70) cout << 'C';
else if (score >= 60) cout << 'D';
else cout << 'F';
return 0;
}