본문 바로가기
프로그래밍/알고리즘 풀이

[알고리즘] 백준 9498번 시험 성적 Java

by 방구석개발자 2020. 6. 29.
반응형

다중 if 문을 사용하여 작성하였습니다.

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        // 인자를 받는다.
        Scanner scan= new Scanner(System.in);
        String InputNum=scan.nextLine();

        int score=Integer.parseInt(InputNum);

        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");
    }

}
반응형

댓글