The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y.
Write a recursive method Gcd that returns the greatest common divisor of x and y.
The Gcd of x and y is defined recursively as follows:
If y is equal to 0, then Gcd( x, y) is x; otherwise, Gcd( x, y ) is Gcd( y, x % y ), where % is the modulus operator.
The greatest common divisor of integers x and y
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Dec 10, 2012, 1:12 PM EST
Daril148 reputationPosted Nov 8, 2021, 6:27 AM EST