Factorial of a number using Recursion

Factorial of a number is defined as the product of natural numbers starting from 1 to the number that we want to find factorial for. Mathematically, it is defined as follows.

n! = 1*2*3*4* . . . . . .*(n-1)*n

For example, 5!= 1*2*3*4*5=120

Algorithm or Mathematical Generating Function can be written as follows.

It is very easy to transform above algorithm or generating function into program that uses Recursion. Below one is the implementation in Java.

Factorial of a given number using Recursion in Java

Here is the implementation for  Factorial of a number using recursion

 

Leave a Comment