Created
April 9, 2015 14:25
-
-
Save gilrg18/05c25b161243c16a6cdf to your computer and use it in GitHub Desktop.
Greatest common divisor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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