so for example
public class GCD {
public static void main(
String[] args) throws IOException{
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
int diff=0;
System.out.println("Enter num1: ");
int x = Integer.parseInt(read.readLine());
System.out.println("Enter num2: ");
int y = Integer.parseInt(read.readLine());
x = Math.max(abs(x), abs(y));
y = Math.min(abs(x), abs(y));
[deleted]
System.out.print("GCD of the nums :"+diff);
}
private static int abs( int arg) {
return arg > 0 ? arg : -arg;
}
}
note: bad style with the static abs, but just to quick fix
)
[edit]Delete solution. CR[/edit]