The program tries out various interest rates starting at zero percent. For each interest rate, the initial amount of dollars must be reset back to the amount in the account at the beginning of the first year.
Here is a flowchart that shows the logic of the program.
Observe how one loop is nested inside of another.
Notice how dollars
is initialized to initialAmount
each time the inner loop is started.
Study how rate
is adjusted to a new rate at the top of the loop body of the outer loop.
Does rate
keep increasing as the program runs?