Absolutely NOT! That's 80 years without chocolate-chip cookies!
We obviously need to find a bank with an interest rate higher than five percent. Say that you are willing to wait 40 years for your million dollars. How high must the interest rate be?
One way to answer this question is to try out various interest rates until you find one that works. Here is a program that does that. It asks for an interest rate, then calculates how much money will be in the account after 40 years.
This program does NOT use a result-controlled loop.
It uses a counting loop because the counter, year
,
is used to control the loop and is incremented until it reaches a limit.
Fill in the blanks to complete the program.