day04_FlowEx3

육희영·2021년 9월 2일
0
post-thumbnail
package day04;

import java.util.Scanner;

public class FlowEx3 {

	public static void main(String[] args) {
		System.out.println("숫자를 하나 입력하세요.>");

		Scanner scanner = new Scanner(System.in);
		int input = scanner.nextInt();
		scanner.close();

//		if (input == 0) {
//			System.out.println("입력하신 숫자는 0입니다.");
//		}
//		else  {
//			System.out.println("입력하신 숫자는 0이 아닙니다.");
//		}

		if (input == 0) {
			System.out.println("입력하신 숫자는 0입니다.");
		} else if (input == 1) {
			System.out.println("입력하신 숫자는 1입니다.");
		} else if (input == 2) {
			System.out.println("입력하신 숫자는 2입니다.");
		} else {
			System.out.println("입력하신 숫자는 0,1,2가 아닙니다.");
		}

	}

}

출력결과

0개의 댓글

관련 채용 정보