Skip to content

Commit

Permalink
Update Exercício 076.py
Browse files Browse the repository at this point in the history
Added the code and a note about code function
  • Loading branch information
mateusadada committed May 17, 2023
1 parent dc108e8 commit 61f30ad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Exercícios resolvidos/Exercício 076.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# Exemplo de cálculo de fatorial

def fatorial(fat):
total = 1
if fat < 1:
return 'Erro! O número é negativo ou nulo'
else:
while fat > 1:
total *= fat
fat -= 1
return total


print('Bem vindo ao programa de cálculo de fatorial a partir de uma função!')
numero = int(input('Digite um número: '))

print(f'\nFatorial de {numero}: {fatorial(numero)}')

0 comments on commit 61f30ad

Please sign in to comment.