본문 바로가기
Baekjoon Online Judge

[BOJ] 백준 9498번 시험 성적 (Java)

by 프로그래 밍구 2022. 11. 17.

문제링크

https://www.acmicpc.net/problem/9498

 

9498번: 시험 성적

시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.

www.acmicpc.net


나의코드

import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
sc.close();
if(a >= 90){
System.out.print("A");
}else if(a >= 80){
System.out.print("B");
}else if(a >= 70){
System.out.print("C");
}else if(a >= 60){
System.out.print("D");
}else{
System.out.print("F");
}
}
}

 

댓글