merge: Add test case (#851)

* Add test case

* minor fix

* delete files

* rename file
This commit is contained in:
YATIN KATHURIA
2021-11-27 12:58:18 +05:30
committed by GitHub
parent c33b19a731
commit 51415f8a12
3 changed files with 29 additions and 11 deletions

18
Recursive/Factorial.js Normal file
View File

@ -0,0 +1,18 @@
/**
* @function Factorial
* @description function to find factorial using recursion.
* @param {Integer} n - The input integer
* @return {Integer} - Factorial of n.
* @see [Factorial](https://en.wikipedia.org/wiki/Factorial)
* @example 5! = 1*2*3*4*5 = 120
* @example 2! = 1*2 = 2
*/
const factorial = (n) => {
if (n === 0) {
return 1
}
return n * factorial(n - 1)
}
export { factorial }