python programme to calculate greatest common divisior (GCD) using recursion

def gcdIter(a, b):

”’

a, b: positive integers

returns: a positive integer, the greatest common divisor of a & b.

”’

# Your code here

Recursive Method

 if a == b:

 return a

  elif a > b:

 return gcdIter(a-b, b)

elif b > a:

return gcdIter(a, b-a)

Advertisements