factorial() All Math methods
factorial is the product of all the positive integers less than or equal to input number.
!n is also denoted as factorial of a number .
factorial of 4 is 24.
print(math.factorial(4)) # 24
Factorial of a number without using the factorial() function
print(math.factorial(12)) # 479001600
Output is here
for i in range (1,n+1):
factorial=factorial * i
Factorial of a Number
Find the factorial of an input number. check the number before using factorial() method.
Check your answer without importing math module.
x=input("Enter the number : ")
print(" Enter correct number ")
This article is written by plus2net.com team.