Problem Solving
[백준/Java] 9498번 - 점수에 따른 성적 출력
Jintiago
2022. 3. 24. 03:34
90~100점은 A, 80~89점은 B, ... , 60점 미만은 F가 출력되게 하란다.
import java.util.Scanner;
public class Main{
public static void main(String args[]){
Scanner s = new Scanner(System.in);
int score = s.nextInt();
if (score >= 90){
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");
}
}
}
if, else if, else 문을 활용한 간단한 프로그램이다.
문제에서 성적 구간을 잘못 읽어서 또 틀렸다.
문제를 잘 읽자!