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 .
import math
print(math.factorial(4))    # 24
factorial of 4 is 24.
import math
print(math.factorial(12))    # 479001600
Factorial of a number without using the factorial() function
n=12
factorial=1
for i in range (1,n+1):
    factorial=factorial * i
print(factorial)
Output is here
479001600
Factorial of a Number

Practice Questions

Find the factorial of an input number. check the number before using factorial() method.
Check your answer without importing math module.
import math
x=input("Enter the number : ")
if x.isdigit():
  print(math.factorial(int(x)))
else:
  print(" Enter correct number ")

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer