본문 바로가기

프로그래밍/자바

[자바] 정올 531 : 선택제어문 - 자가진단4

728x90
반응형
SMALL
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double w = sc.nextDouble();
        if (w > 88.45) System.out.println("Heavyweight");
        else if (w > 72.57 && w <= 88.45) System.out.println("Cruiserweight");
        else if (w > 61.23 && w <= 72.57) System.out.println("Middleweight");
        else if (w > 50.80 && w <= 61.23) System.out.println("Lightweight");
        else if (w <= 50.80) System.out.println("Flyweight");
    }
}
728x90
반응형
LIST