Ask Question
6 December, 00:25

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

+1
Answers (1)
  1. 6 December, 01:10
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers