Write a Python program to find the factorial of a number.

Factorial of any non-negative number is the multiple of all the numbers smaller than or equal to n.

Example: Factorial of 4 is 4*3*2*1=24.

There are several ways to find factorial of any number in Python, let’s see each of them.

Iterative Method


Recursive Method


Using factorial() in Python

Python has inbuilt factorial() method defined in “math” module which return the factorial of non negative integral number.


factorial() Parameters

n– Number whose factorial need to be calculated.

Let’s see an example.


If you have any doubts or suggestion then please comment below.

Leave a Reply

four × two =