Ask Question

Write code to complete doublepennies () 's base case. sample output for below program: number of pennies after 10 days: 1024 note: these activities may test code with different test values. this activity will perform three tests, with startingpennies = 1 and userdays = 10, then with startingpennies = 1 and userdays = 40, then with startingpennies = 1 and userdays = 1. see "how to use zybooks". also note: if the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.

+4
Answers (1)
  1. 21 January, 13:35
    0
    Int resultPennies = startingPennies;

    for (int i = 0; i < userDays; i++) {

    resultPennies * = 2;

    }

    return resultPennies;

    The above code should do. You will need to adapt this code to your desired language, as you never specified a language.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write code to complete doublepennies () 's base case. sample output for below program: number of pennies after 10 days: 1024 note: these ...” in 📗 Computers & Technology 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