0

I have question guys

You have a magic box that doubles the count of items you put, in every day. The given program takes the initial count of the items and the number of days as input. Task Write a program to calculate and output items' count on the last day. Sample Input 3 2 Sample Output 12 how to solve this?

7th Dec 2021, 9:44 AM
Luki Zainur Ismawan
Luki Zainur Ismawan - avatar
2 ответов
+ 1
1. Two inputs has to be accepted 2. Then, start a counter variable 3. Use a loop to double the items 4. When the loop executes as many times as the number of days, print the items count If you still have doubts, try to run your code on IDE and correct mistakes
7th Dec 2021, 11:14 AM
Neethu Nath
Neethu Nath - avatar
0
Here's another way to double value every day. You have 3 items, then 6, then 12, 24, 48... You have doubled it 4 times. See the pattern? Use it
8th Dec 2021, 7:32 AM
Ivan Petriv
Ivan Petriv - avatar