For positive integers a and b, the greatest common divisor of a and b satisfies the
following recurrence relationship:
gcd(a,b) = b if a mod b = 0
gcd(a,b) = gcd(b, a mod b) if a mod b z 0
Write a recursive function gcd(a,b) using these recurrences. Test the program by
finding gcd(24,36), gcd(16,13), gcd(17,119), and gcd(177,228).
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here