Created
October 22, 2017 10:25
-
-
Save rajatdiptabiswas/3871545a90ba2746a216c213f7608118 to your computer and use it in GitHub Desktop.
Euclid's Algorithm to find GCD of two numbers
This file contains hidden or 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
#!/usr/bin/env python3 | |
def gcd(a, b): | |
if b == 0: | |
return a | |
else: | |
return gcd(b, a % b) | |
a = int(input("a = ")) | |
b = int(input("b = ")) | |
print("The GCD of {} and {} is {}".format(a, b, gcd(a, b))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment