← Back to Loops
Question 395
Years To Double
Years To Double
Read a starting balance and a yearly interest rate as a percentage (for example 5 means 5 percent). Use a while loop that multiplies the balance by 1 + rate / 100 once per year and counts the years until the balance is at least double the starting amount, then print Years: <count>. Input: two lines, the balance then the rate, both numbers, no prompts.
Expected Output:
Years: 15= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Loops
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.