Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A group of monkeys have N bananas in day 1. In the next each day, these monkeys eat half the number of current bananas plus

image text in transcribed

A group of monkeys have N bananas in day 1. In the next each day, these monkeys eat half the number of current bananas plus one more banana. When the number of the banana n is odd, its half is counted as the lower bound. For example, when 21, half of n should be 10, and 10+1=11 bananas will be eaten on this day. - Write a program to compute the number of bananas N in the first day, based on the current day d and current number of bananas n. The input of the program should be the current day d and current number of bananas n, and the output of the program should be the number of bananas N in the first day. We assume that before day d, the number of bananas n in every previous day is even. For example, if in day 3 we have n3 12, then the number of bananas in day 2 should be n2 (n3 + 1) * 2 = 26, and the original number of bananas in day 1 should be N = n1 = (n2 + 1) * 2 = 54. (3 marks) =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

Explain all drawbacks of application procedure.

Answered: 1 week ago

Question

Explain the testing process of accounting 2?

Answered: 1 week ago