알고리즘/백준
[Python/Java] 백준 9498번 - 시험 성적
소꿍
2020. 6. 8. 16:46
https://www.acmicpc.net/problem/9498
9498번: 시험 성적
시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
Python
score = int(input())
if 90 <= score <= 100:
print('A')
elif 80 <= score <= 89:
print('B')
elif 70 <= score <= 79:
print('C')
elif 60 <= score <= 69:
print('D')
else:
print('F')
Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
if(90 <= n && n <= 100) {
System.out.println("A");
} else if (80 <= n && n <= 89) {
System.out.println("B");
} else if (70 <= n && n <= 79) {
System.out.println("C");
} else if (60 <= n && n <= 69) {
System.out.println("D");
} else
System.out.println("F");
}
}