➽ Program:-
Num = int(input("Enter a Number:
"))
Factorial = 1
#check if the Number is
negative, positive or zero
if(Num < 0):
print("Sorry,
factorial does not exist for negative numbers")
elif(Num == 0):
print("Factorial of 0 is 1")
else:
for c in range(1,
Num+1):
Factorial = Factorial * c
print("Factorial of",Num,"is",Factorial)
➽ Output:-
Enter a Number: 8
Factorial of 8 is 40320
0 Comments
Please do not enter any spam link in the comment section.