【Problem Description】
Use the recursive method to write the program to find the greatest common factor. The greatest common factor of two positive integers x and y is defined as: if y<=x and x mod y=0, gcd(x,y)=y; if y>x, gcd(x,y)=gcd (y,x); In other cases, gcd(x,y)=gcd(y,x mod y)
[input form]
The user enters two numbers on the first line, separated by spaces.
【Output form】
The program outputs the greatest common factor of the two previously entered numbers on the next line.
【Sample input】
36 24
【Sample output】
12
【Example description】
User input 36, 24, program output
Their greatest common factor is 12
def gys(a,b):
if a % b == 0:
return b
else:
return gys(b,a%b)
a,b = map(int,input().split())
print(gys(a,b))