MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / func

Function func

CPP/recursion/recursion 1.cpp:11–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10using namespace std;
11void func(int n){
12 if(n==0) return;
13 func(n-1);// OUTPUT 1 2 3 4 5
14 cout<<n<<endl;
15 // cout<<n<<endl; OUTPUT 5 4 3 2 1
16 // func(n-1);
17}
18int fact(int n){
19 if(n==0) return 1;
20 return fact(n-1)*n;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected