β Factorial - Recursion(Contest)
Factorial - Recursion easy asked in interviews by 16 companies Time Limit: 2 sec Memory Limit: 128000 kB
Problem Statement :
Find factorial of a given number N.InputUser Task Since this is a functional problem, you don't have to worry about the input. You just have to complete the function Factorial() which contains the given number N. Constraints: 1 <= N <= 15 OutputReturn the factorial of the given number.ExampleSample Input:- 5 Sample Output:- 120 Sample Input:- 3 Sample Output:- 6
link:https://my.newtonschool.co/playground/code/zblvil63nj08/
static int Factorial(int N){
//Enter your code here
if(N == 0){
return 1;
}else
return (N * Factorial(N-1));
}
```
Last updated