Recursion help!

I don't know how to do this exercise from book "C++: Without Fear" :

Write a program that calculates triangle numbers by using a recursive
function. A triangle number is the sum of all whole numbers from 1 to N, in
which N is the number specified. For example, triangle(5) = 5 + 4 + 3 + 2 + 1.
If you had a function triNum(int n); which calculated the triangle number of n, it would be true for all numbers that triNum(n) is equal to n + triNum(n-1). Does this help? Have you ever created a recursive function before?
Last edited on
Well yea. I created prime factorization(Actually book maker created it i just learn.
Last edited on
EDIT: I didn't need your help, but thanks anyway i was confused at some place, lol, sorry again :(.
Last edited on
Topic archived. No new replies allowed.