Program to find the factorial of a number

The factorial is a positive integer n, denoted by n!, is the product of all positive integer less then or equal to n.

For examle:
5! = 54321 = 123
The factorial value 5 is 24.

n = int(input("Enter a number"))

Factorial = 1
if n<1:
print("if factorial does not exist of negative number")
elif n==0:
print ("The factorial of 0 is 1")
for i in range(1,n+1):
factorial = factorial*i
print("The factorial of",n,"is",factorial)

Leave a Reply