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

17 lines
407 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-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
2022-10-18 17:18:56 +00:00
if __name__ == "__main__":
main()