티스토리 뷰

import java.util.Scanner;

import java.util.InputMismatchException;

import java.lang.ArithmeticException;


class adqewrsf{

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in); 

try {

int x = scanner.nextInt();


System.out.println("결과 = " + 100 / x);


}

catch(ArithmeticException e) {

System.out.println("0이 입력되었습니다!");

}

catch(InputMismatchException s) {

System.out.println("숫자를 입력해주세요!");

}

}

}

댓글
댓글쓰기 폼