MCPcopy Create free account
hub / github.com/chaharnishant11/CodeIn10DSA / factorial

Method factorial

Recursion/Homework/factorial.cpp:6–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4class Solution{
5public:
6 long long int factorial(int N){
7 // Base Case
8 if (N == 1 || N == 0){
9 return 1;
10 }
11
12 // Recursive Call
13 long long int recResult = factorial(N-1);
14
15 // Small Calculation
16 long long int result = N*recResult;
17
18 return result;
19 }
20};
21
22int main()

Callers 1

mainFunction · 0.80

Calls 1

factorialFunction · 0.50

Tested by

no test coverage detected