The definition of recursion (essentially) is to call a method from within that same method, so, knowing that, and knowing that you need to add N to N - 1 what do you think might be appropriate in that "blank"?
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,484
Solved Threads: 494
Skill Endorsements: 17
@Prem
I know you are trying to help, but if you give the OP a complete solution then what have you done? You have helped them cheat, and taught them nothing.
It's better to help by pointing him in a good direction, and suggesting relevant topics to read up.
JamesCherrill
... trying to help
8,666 posts since Apr 2008
Reputation Points: 2,636
Solved Threads: 1,476
Skill Endorsements: 33
Aside from the fact that the provided code has nothing to do with the posted question. ;-)
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,484
Solved Threads: 494
Skill Endorsements: 17
I should have looked more closely. :-(
@Prem
I know you are trying to help, but if you give the OP a completely incorrect solution then what have you done?
JamesCherrill
... trying to help
8,666 posts since Apr 2008
Reputation Points: 2,636
Solved Threads: 1,476
Skill Endorsements: 33
Hi Prem
Yes, that's much better code.
But please take note of the main point: if you give someone the answer to their homework the you are not really helping them. You should help them to gain the skills and knowledge that they need to do their own homework.
JamesCherrill
... trying to help
8,666 posts since Apr 2008
Reputation Points: 2,636
Solved Threads: 1,476
Skill Endorsements: 33
I blindly wrote a small program and posted it .
(*)But for that you(masijade) will not put the negative points to my post.Mistakes may be happen at any time for any one.pls rememeber that.
Sorry, but with a join date from over a year ago you should, already, be fully familiar with our policies on that.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,484
Solved Threads: 494
Skill Endorsements: 17