This appears to be a similar topic.
http://cboard.cprogramming.com/showthread.php?t=108515
This appears to be a similar topic.
http://cboard.cprogramming.com/showthread.php?t=108515
Yes, but it's not "how to solve this problem" that is the question here, but how to solve it recursively.
I'm not sure if transgalactic have a teacher that still wishes that he (she) was using lisp or some other purely functional language where recursion is the natural method of solving ALL repetitions, but I personally think it's a bad idea to try to solve all problems [as one function, at least] via recursion.
Like Salem says, it's like "Can you tie your shoelaces with one hand" - it has little practical use in real life [except for those relatively few people who for some reason can't use both hands for daily tasks, e.g. from birth defects, accidents, etc].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.