Factorial Number
The factorial of a number is the product of all the integers from 1 to that number.
For example, the factorial of 5 is 5*4*3*2*1. Factorial is not defined for negative numbers, and the factorial of zero is one, 0!=1.
For example, the factorial of 5 is 5*4*3*2*1. Factorial is not defined for negative numbers, and the factorial of zero is one, 0!=1.
n=int(input("Enter the Number: ")) def factorial(n): if(n==0): return 1 elif(n<0): return("Incorrect number") else: return(n*factorial(n-1)) print('\n'"Factorial of",n,"is",factorial(n))
If you have any doubts, feel free to post it in comment Section.
Comments