Ask Question
22 December, 11:16

Write a program that calculates how many days it takes to accumulate at least $1,000,000 if someone deposits one penny on the first day, two pennies the second day, four pennies on the third day and continues to double each day. The output should display the number of days

+2
Answers (1)
  1. 22 December, 11:30
    0
    Step-by-step explanation:

    Let's do this in Python

    day = 1

    balance = 0

    deposit = 0.01 # first deposit is 1 penny

    while balance < 1000000: # execute the loop as long as balance is less than a million dollar

    balance + = deposit

    deposit = deposit * 2 # double the deposit for the next time

    day + = 1 # add one to day for the next day

    print (day) # print out result once loop ends
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a program that calculates how many days it takes to accumulate at least $1,000,000 if someone deposits one penny on the first day, ...” in 📙 Mathematics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers