import java.util.Scanner;
import java.util.InputMismatchException;

class DivideInteiros
{
	public static int divide(int n, int d) throws Exception
	{
		if (d == 0){
			ArithmeticException ex = new ArithmeticException();
			throw ex;
		}
		if (n == 0){
			Exception ex = new Exception();
			throw ex;
		}
		return n/d;
	}

	public static void main( String args[] )
	{
		int n, d;
		boolean erro;
		Scanner scan = new Scanner(System.in);

		do{
			try
			{
				erro = false;
				System.out.println("Digite um valor para o numerador: ");
				n = scan.nextInt();

				System.out.println("Digite um valor para o denominador: ");
				d = scan.nextInt();

				System.out.println("Divisao inteira = " + divide(n, d));
			}
			catch(Throwable e)
			{
				erro = true;
				System.out.println("Erro: " + e);
			}
		}while( erro );
	}
}
