Created
November 12, 2020 11:13
-
-
Save thinkphp/c206164ef730b4fa44ae2d8c6c5488e4 to your computer and use it in GitHub Desktop.
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
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