
Calculating Sums
I need to calculate a sum of cubes in one of my programs, but have no idea how to get started. I started using a For loop but have had lots of trouble getting results. I am asking the user to put in a maximum integer and i cube it, then i add the values before it cubed. Ie: a user enters 5 and i need to calculate 5^3 + 4^3 + 3^3 + 2^3 + 1^3. I don't know how to do this and its a pretty big part of my program. Thanks!

still confused
i know that i should be using a function, but i can't figure out the loop. i have it set up like this:
for(iNumber =1; iNumber<iMax; iNumber++)
iAns: pow(iMax,3) + pow(iNumber,3);
printf("Sum of the cubes: blah blah blah);
but i can only get the last number of the for loop in there, i need it to be iNumber1^3 + iNumber2^3, etc. is there a way to sum the numbers in my for loop? i am not good at this stuff.

Re: still confused
Code:
TotVal = 0
for(iNumber =1; iNumber<iMax; iNumber++)
{
TotVal += pow(iNumber,3);
}
printf("Sum of the cubes: blah blah blah);

Thanks everybody, i got it working!