factorial program in python

Factorial In Python Programing

The factorial of a number is a mathematical concept that represents the product of all positive integers less than or equal to that number. For example, the factorial of 5 (written as 5!) is 5 x 4 x 3 x 2 x 1 = 120. Factorials are commonly used in mathematics, statistics, and computer science. 

In easy wording, the factorial of a number is the result of multiplying that number by every positive integer smaller than it. The factorial of a positive integer n is denoted by "n!".

Factorial formula

n! = n x (n-1) x (n-2) x (n-3) . . . x 1

If we find factorial 5

5! = 5 x (5-1) x (5-2) x (5-3) x (5-4)
5! = 5 x 4 x 3 x 2 x 1
5! = 120

Python Code

n = int(input("Enter Number for find factorial = "))
f=1
for i in range(1 , n+1):
    f=f*i
print(f"Factorial of {n} is {f}")

Implementation in Python👇👇👇

LIKE SHARE AND SUBSCRIBE