Dúvidas de Fatorial
resolução com FOR e WHILE
Size 1 kB - File type text/plainFile contents
================ FATORIAL ==================================
n = int (input("Fatorial de um numero:"))
for i in range(n):
print(i, " ", n)
if (i == 0):
fat = 1*n
else:
fat = fat*i
print(fat)
================ FATORIAL ==================================
fat = 1
contador = 1
n = int (input("Fatorial de um numero:"))
while (contador <= n):
fat = fat * contador
contador = contador +1
print(fat)
Click here to get the file