Investment program

Pages: 12
Pheininger has been trying to get you to see that the loops at lines 20 and 25 in your latest code post never execute:
1
2
3
4
5
6
    Lprinciple = 1000; 
    while (Lprinciple>1000)
    {
	Lprinciple = (Lprinciple + (Lprinciple*Lintrest));
        Lprinciple+=10;
    }
Line 1 assigns 1000 to Lprinciple. Line 2 tests if Lprinciple>1000. It is equal to 1000, not greater, so the test fails and the while loop doesn't execute.

You may not need the for loops at line 20 and 25, depending on the compounding period of the interest. Is interest supposed to be compounded annually? monthly? Daily? Continuously?

I suggest that you grab a pencil and calculator and compute the values for each person at ages 20, 21 and 22. Write them in a reply here. That will help you and us understand how this program should work.
Topic archived. No new replies allowed.
Pages: 12