Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1c2e7dd

Browse files
authored
Update 02 head recursion.cpp
1 parent a646989 commit 1c2e7dd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎Recursion/02 head recursion.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,26 @@ int main (){
1414
}
1515

1616
// This will give output as 1 2 3 4 5 6 7 8 9
17+
18+
19+
#include<iostream>
20+
using namespace std;
21+
22+
void func(int n)
23+
{
24+
if (n>0)
25+
{
26+
func(n-1);
27+
cout<< n<<" ";
28+
}
29+
}
30+
31+
32+
33+
int main ()
34+
{
35+
int a;
36+
cin>>a;
37+
func(a);
38+
return 0;
39+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /