# Thread: need to understand code

1. Member
Join Date
Feb 2011
Posts
5
Rep Power
0

## need to understand code

Iterating over the numbers 1 .. 10 and write in each an iteration (cycles in the loop) the sum of the current number and all the previous figures. Eg fourth iteration is the number 1 +2 +3 +4 = 10. For the first four iterations will be printed in the console 1, 3, 6, 10. Tip: for an extra variable that you use to store the value from the previous iterations.

What i have got is that i know tthat i have to make a program that adds the preveius numbers with the next like 1+2 = 3 ant then 1+2+3=6 and so on but i dont know were to put it so that the next number apperars in the next line

2. Sorry, but you can't just keep posting your homework questions here without showing any real effort. What have you tried? What worked, what didn't work? How didn't it work? Be specific.

Throw together an SSCCE that demonstrates where you're stuck, and we can go from there.

3. Member
Join Date
Jan 2011
Posts
27
Rep Power
0
Read up on loops, for loop, while, do while, and decide which is best to solve your problem

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•