Skip to content

Instantly share code, notes, and snippets.

@Ken-Kuroki
Created October 6, 2019 09:12
Show Gist options
  • Save Ken-Kuroki/49070f807d2a50bfba66e78dd926c358 to your computer and use it in GitHub Desktop.
Save Ken-Kuroki/49070f807d2a50bfba66e78dd926c358 to your computer and use it in GitHub Desktop.
Calculate GCD
def get_gcd(a, b):
if b > a:
a, b = b, a
r = a%b
if r == 0:
return b
else:
return get_gcd(b, r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment