Write a program that reads two integers from keyboard and calculate the greatest common divisor (gcd) using recursive function.
Source Code
def gcd(x, y):
if (x % y == 0):
return y
else:
return gcd(y, x % y)
#calling the gcd function
num1 = 28
num2 = 16
print(num1,"and",num2,"gcd is", gcd(num1,num2))
Output