public class Main {
	
	// ideone doesn't support cmd args
	static final String[] ARGS = {"24", "18"};
	
	public static void main (String[] args) {
		int a = Integer.parseInt(ARGS[0]);
		int b = Integer.parseInt(ARGS[1]);
		System.out.printf("GCD of %d and %d: %d%n", a, b, gcd(a, b));
	}
	
	public static int gcd(int a, int b) {
		if (b > a) return gcd(b, a);
		else if (b == 0) return a;
		else if (a == 0) return b;
		else return gcd(b, a%b);
	}
}