CJCoding With Joseph
15free / daySign inCreate account

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
Topics:
Loops
📥 Auto-Input:
1000\n5\n
This input is automatically fed to your program's stdin
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.