# Factorial Number Using Recursion in Python

A Python program to print the factorial number using recursion. This program can print the factorial number using the recursion method. The product of all positive integers less than or equal to a particular positive integer, indicated by that integer and an exclamation point in mathematics. As a result, factorial seven is expressed as 7!, which means 1 2 3 4 5 6 7. The factorial zero is equal to one.

Factorial is the mathematical definition of multiplying any natural number by all the natural numbers that are smaller than it, giving us n! = n * (n – 1) * (n – 2) * (n – 3)…. Finally, factorial is used to ask how many different ways you may arrange or organize a specific amount of items.

`def recursion(n): if n == 1: return n else: return n*recursion(n-1) num = int(input("Enter a number")) if num < 0: print("factorial numbers can't be negative number") elif num == 0: print("The factorial of 0 is 1") else: print("The factorial of",num,"is",recursion(num)) `

Output:

Enter a number 5
The factorial of 5 is 120

## What is conditional statement and what is if else condition in python

Conditions are examined by the software in decision-making statements. A group of statements is executed if the condition is true, while another set of statements is run if the condition is false. Otherwise, the statements in else’s body are executed.

The if-else condition is used to execute both the true and false parts of a condition. The if block code is run if the condition is true, and the else block code is executed if the condition is false.

## What is indentation in python

Indentation is used in Python to highlight code blocks. In Python, indentation is done with whitespace. All statements with the same right-hand distance belong to the same code block. If a block has to be nested further deeply, it is simply indented to the right.