uaveiro-leci/1ano/fp/aula03/ex13.py

16 lines
396 B
Python
Raw Normal View History

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)
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-11 22:31:33 +00:00
print('\nO Máximo Divisor Comum de \'{}\' e \'{}\' é: {}'.format(n1, n2, mdc(n1, n2)))
2022-10-11 19:27:51 +00:00
main()