알고리즘(C++)/백준 알고리즘
9498번 : 시험 성적
개발하는꼬물이
2017. 11. 19. 14:46
1. 문제 요약
시험 점수를 입력받아 90 - 100 점은 A, 80 - 89점은 B, 70 - 79점은 C, 60 - 69점은 D, 나머지 점수는 F를 출력하는
프로그램을 작성하시오. (시험점수는 0보다 크거나 같고, 100보다 작거나 같은 자연수이다.)
2. 예제 입력
100
3. 예제 출력
A
4. 코드
#include <iostream> using namespace std; int main() { int score; cin >> score; if (score < 0 || score > 100) return 0; if (score > 89) cout << "A" << endl; else if(score > 79) cout << "B" << endl; else if (score > 69) cout << "C" << endl; else if (score > 59) cout << "D" << endl; else cout << "F" << endl; return 0; }