Skip to content

Instantly share code, notes, and snippets.

@gilrg18
Created April 9, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilrg18/05c25b161243c16a6cdf to your computer and use it in GitHub Desktop.
Save gilrg18/05c25b161243c16a6cdf to your computer and use it in GitHub Desktop.
Greatest common divisor
#Gilberto Rogel García wsq12 greates common divisor
def gcd(x,y):
if(x==y):
res=x
elif(x>y):
res=gcd((x-y),y)
else:
res=gcd(x,(y-x))
return res
x=int(input("Give a number:"))
y=int(input("Give me another number:"))
z=gcd(x,y)
print("The greatest common divisor of your numbers is",z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment