2
Answers

The greatest common divisor of integers x and y

ahmed sami

ahmed sami

12y
4k
1
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.
Answers (2)