Baekjoon Algorithm | Problem 9498: Exam Score

Source

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

Problem

Solve Baekjoon Online Judge problem 9498, Exam Score.

Input

Follow the input format and constraints given in the original problem statement.

Output

Print the answer required by the problem.

Sample Input 1

100

Sample Output 1

A

Solution

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

            int input = Integer.parseInt(br.readLine());

            String result;
            if (input >= 90)
                result = "A";
            else if (input >= 80)
                result = "B";
            else if (input >= 70)
                result = "C";
            else if (input >= 60)
                result = "D";
            else
                result = "F";

            System.out.print(result);
        }
    }
}