2022-10-11 19:27:51 +00:00
|
|
|
def mdc(a, b):
|
|
|
|
assert a > 0
|
|
|
|
assert b > 0
|
|
|
|
r = a % b
|
|
|
|
if r == 0:
|
|
|
|
return b
|
|
|
|
else:
|
|
|
|
return mdc(b, r)
|
|
|
|
|
2023-05-16 20:00:37 +00:00
|
|
|
|
2022-10-11 19:27:51 +00:00
|
|
|
def main():
|
2022-10-11 22:31:33 +00:00
|
|
|
print('Este programa calcula o máximo divisor comum de dois námeros naturais')
|
2022-10-11 19:27:51 +00:00
|
|
|
n1 = int(input('Numero 1: '))
|
|
|
|
n2 = int(input('Numero 2: '))
|
2022-10-18 17:18:56 +00:00
|
|
|
print(f'\nO Máximo Divisor Comum de {n1} e {n2} é: {mdc(n1, n2)}')
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2023-05-16 20:00:37 +00:00
|
|
|
|
2022-10-18 17:18:56 +00:00
|
|
|
if __name__ == "__main__":
|
2023-05-16 20:00:37 +00:00
|
|
|
main()
|