Skip to content

Instantly share code, notes, and snippets.

@luanfonceca
Created September 27, 2013 22:54
Show Gist options
  • Save luanfonceca/6736358 to your computer and use it in GitHub Desktop.
Save luanfonceca/6736358 to your computer and use it in GitHub Desktop.
Algoritmo de Euclides em Python.
def rmdc(a, b):
return b and rmdc(b, a%b) or a
def mdc(a, b):
while a:
a, b = b%a, a
return b
if __name__ == '__main__':
a = input("Informe o primeiro valor: ")
b = input("Informe o segundo valor: ")
print "Valor final: %s" % rmdc(a, b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment