import java.io.DataInputStream; import java.io.*; public class Javnan { public static void main(String[] args) throws IOException { int x = 0; int y = 0; float result = 0; String input = new String(); boolean valid = false; DataInputStream in = new DataInputStream(System.in); while ( ! valid ) { try { System.out.print( "Dwse akeraio GAY: " ); input = in.readLine(); x = Integer.parseInt( input ); valid = true; } catch ( NumberFormatException e ) { System.out.println( e.getMessage() + " mpravo malaka, aftos den einai akeraios." ); } } valid = false; while ( ! valid ) { try { System.out.print( "Dwse allon enan: " ); input = in.readLine(); y = Integer.parseInt( input ); valid = true; } catch ( NumberFormatException e ) { System.out.println( e.getMessage() + " mpravo malaka, aftos den einai akeraios." ); } } try { result = x/y; System.out.println("apotelesma: " + result); } catch ( ArithmeticException arithmeticException ) { System.out.println( arithmeticException.getMessage() + " o diairetis einai 0, ZWO." ); } } }