CODE:
#to find a factorial of a number
n=int(input("Enter the number"))
fact=1
if n<0:
print("Error, actorial cannot be a negative number")
elif n==0:
print("The factorial of 0 is 1")
else:
for i in range(1,n+1):#n+1=5+1, if the entered no. is 5
fact=fact*i
print("The factorial of",n,"is",fact)
OUTPUT:
#to find a factorial of a number
n=int(input("Enter the number"))
fact=1
if n<0:
print("Error, actorial cannot be a negative number")
elif n==0:
print("The factorial of 0 is 1")
else:
for i in range(1,n+1):#n+1=5+1, if the entered no. is 5
fact=fact*i
print("The factorial of",n,"is",fact)
OUTPUT: