# Answer to Question #3373 in Python for mukunda

Question #3373

Write a program to find the Greatest common divisor in recursive method

Expert's answer

def gcd_rec (a, b, x):

if a % x == 0 and b % x == 0:

& return x

return gcd_rec (a, b, x-1)

def gcd (a, b):

return gcd_rec (a, b, min(a,b)-1)

print(gcd(8,12))

if a % x == 0 and b % x == 0:

& return x

return gcd_rec (a, b, x-1)

def gcd (a, b):

return gcd_rec (a, b, min(a,b)-1)

print(gcd(8,12))

## Comments

## Leave a comment