Etc/백준(JAVA) 문제풀이
[백준] 9498번 Java 문제풀이
pplucy
2021. 1. 7. 02:35
시험 성적에 맞게 등급을 출력해주는 문제다.
이 문제는 else-if문이나 switch 문을 사용해주면 되는데
나는 간단하게 else-if문을 사용했다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int score = sc.nextInt();
if(score >= 90 && score <= 100) {
System.out.println("A");
}else if(score >= 80) {
System.out.println("B");
}else if(score >= 70) {
System.out.println("C");
}else if(score >= 60) {
System.out.println("D");
}else {
System.out.println("F");
}
}
|
cs |