you are not giving anything here...there is no interaction with user.
you are not giving anything here...there is no interaction with user.
Look at my example, note:
1) You call the recursive function ONE time, only. After that ONE call in main(), the recursive function calls itself the correct number of times, because you set up the base case. That tells it when it should end.
Remove your for loop in main() which calls the recursive function.
2) The printing is done INSIDE the recursive function, not in main().
3) You need an if statement in the recursive function, to give it the logic when it should return. You don't have that if statement in yours yet.
I found this thread relevant to your question about recursion...
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
Oh you jokers, Brewbuck and Quzah!
Thanks for the laughs.
A bit like if you go to Google and do a search for Recursion.
I think you can put a signature here.
That's not how functions work. You give them something (or some things), and they give you something back. For instance, if I do
I give the function the value 10, as input, and it gives me back the result, 2.302585 or so. So when you call recursion(6), you are giving the function 6, and you had better be expecting the number 728 back from it.Code:log(10)