백준 9498번 문항  www.acmicpc.net/problem/9498

 

 

 

 

풀이

 

입력한 값이 문제에서 주어진 범위에 해당할 경우에는 범위에 맞는 학점을 출력해준다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.Scanner;
 
public class if_9498 {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        
        if(90<=&& x<=100System.out.println("A");
        else if(80<=x) System.out.println("B");
        else if(70<=x) System.out.println("C");
        else if(60<=x) System.out.println("D");
        else System.out.println("F");
        
        sc.close();
    }
    
}
cs
댓글