Ask Question
29 April, 14:58

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

+3
Answers (1)
  1. 29 April, 15:17
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers