All pastes #542880 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-05 23:22 UTC
rendered paste body
import java.io.DataInputStream

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

DataInputStream in = new DataInputStream(System.in);

System.out.print( "Dwse akeraio GAY: " );

String input = in.readLine();

try {
	int 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 {
	int y = Integer.parseInt( input );
}
catch ( NumberFormatException e ) {
	System.out.println( e.getMessage() + " mpravo malaka, aftos den einai akeraios." );
}

// omoiws

try {
	float result = y/x;
	System.out.println("apotelesma: " + result);
}
catch (ArithmeticException e) {
	System.out.println( e.getMessage() + " o diairetis einai 0, ZWO." );
}

// omoiws