Calculate Factorial of a Number in Python – Programming, Pseudocode Example, C# Programming Example
Python 3

Calculate Factorial of a Number in Python

Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n. For example factorial of 6 is 6*5*4*3*2*1 which is 720.

1.Recursive : 

2. Iterative:

3. One line Solution (Using Ternary operator): 

4. By using In-built function:

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: