slides12-ex05-mdc.py
Click here to get the file
Size
1 kB
-
File type
text/python-source
File contents
def mdc(a, b):
if a % b == 0:
return b
else:
print "Calculando mdc(%d,%d)"%(b, a%b)
return mdc(b, a%b)
#exemplo:
##>>> mdc(70, 42)
##14
##>>> mdc(42, 28)
##14
##>>> mdc(28, 14)
##14
##>>>