uaveiro-leci/1ano/fp/aula04/factorial.py

11 lines
224 B
Python
Raw Normal View History

2022-10-14 22:03:25 +00:00
def factorial(n):
total = 1
for x in range(1, n + 1):
total *= x
return total
def main():
n = int(input('Introduza um número: '))
print('O fatorial de {} é: {}'.format(n, factorial(n)))
main()