import java.io.DataInputStream; import java.io.*; import java.util.*; public class Javnan { public static void main(String[] args) throws IOException { int x = 0, y = 0, result = 0; String input = new String(); DataInputStream in = new DataInputStream(System.in); System.out.print( "Dwse akeraio GAY: " ); try { input = in.readLine(); } catch ( IOException e ) { System.err.println(">>>>" + e.getMessage() ); } try { x = Integer.parseInt( input ); } catch ( NumberFormatException e ) { System.out.println( e.getMessage() + " mpravo malaka, aftos den einai akeraios." ); } // den 3erw ti kaneis edw, an thes to vlepoume. mporeis eite na termatiseis eite na 3anazitiseis ton 1o akeraio System.out.print( "Dwse allon enan: " ); input = in.readLine(); try { y = Integer.parseInt( input ); } catch ( NumberFormatException e ) { System.out.println( e.getMessage() + " mpravo malaka, aftos den einai akeraios." ); } // omoiws try { result = (float)y/(float)x; System.out.println("apotelesma: " + result); } catch (ArithmeticException e) { System.out.println( e.getMessage() + " o diairetis einai 0, ZWO." ); } // omoiws } }