By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,691 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,691 IT Pros & Developers. It's quick & easy.

c-program of sum of n terms using recursion

P: 1
hello for every body of this network,if any one konw c-program of sum of n terms using recursion please post it
Sep 11 '07 #1
Share this Question
Share on Google+
3 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR
Sep 11 '07 #2

Expert 10K+
P: 11,448
hello for every body of this network,if any one konw c-program of sum of n terms using recursion please post it
Suppose I have to add a pile of numbers; I divide the pile in two smaller piles and
let two other people do it; when they're ready I add just the two sums together.
Everybody can add just two numbers together and there's nothing to be done
when you only have one number.

kind regards,

Jos
Sep 11 '07 #3

RRick
Expert 100+
P: 463
One way to divide the pile is by making sure that one of the entries to the recursive function is a single number. The other entries are the pile of numbers and the total count.

If the single number is taken from the bottom of the pile, you just have to decrement the total count and can leave the pile of numbers unchanged.

Once you have total count = 1, then you can add two numbers together and return their value. Recursion takes care of the rest.
Sep 11 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.