Skip to content

Instantly share code, notes, and snippets.

@enricocirignaco
Created June 1, 2021 14:23
Show Gist options
  • Save enricocirignaco/9aeb64fb02e23a923bc0b45b6c533a26 to your computer and use it in GitHub Desktop.
Save enricocirignaco/9aeb64fb02e23a923bc0b45b6c533a26 to your computer and use it in GitHub Desktop.
greatest common divisor (GCD) Python
a = int(input('first number '))
b = int(input('second number '))
if a < b:
x=a
a=b
b=x
else:
x=b
while x != 0:
x = a % b
print(x)
a=b
b=x
print('ggT is: '+str(a))
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment