X275: Recursion Programming Exercise: GCD

The greatest common divisor (GCD) for a pair of numbers is the largest positive integer that divides both numbers without remainder. For function 'GCD', write the missing base case condition and action. This function will compute the greatest common divisor of "x" and "y". You can assume that "x" and "y" are both integers greater than 0 and that x > y. Greatest common divisor is computed as follows: GCD(x, 0) = x GCD(x, y) = GCD(y, x % y)


GCD(6, 4) -> 2

Practice a different Java exercise