Created
February 11, 2014 20:23
-
-
Save andreipetre/8943353 to your computer and use it in GitHub Desktop.
Calculate the greatest common divisor for two positive integers
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
def gcd(a, b): | |
while b > 0: | |
a, b = b, a % b | |
return a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment