Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created November 12, 2020 11:13
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 thinkphp/c206164ef730b4fa44ae2d8c6c5488e4 to your computer and use it in GitHub Desktop.
Save thinkphp/c206164ef730b4fa44ae2d8c6c5488e4 to your computer and use it in GitHub Desktop.
import sys
def _euclid(a,b):
if(b==0):
return a
else:
return _euclid(b,a%b)
def _euclid_it(a,b):
while(b):
r = a % b
a = b
b = r
return a
def main():
a=int(input("a="))
b=int(input("b="))
#line = sys.stdin.readline()
#ab = line.split("\n")[0]
#ab = ab.split(" ")
#a = int(ab[0])
#b = int(ab[1])
print _euclid_it(a,b)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment