X1179: Recursive Half Left C++

Write a recursive function called half_left that will receive a measurement of the amount of a chemical that is decaying. The amount will continue to reduce by half its amount each day and the function should determine what the amount will be once it drops lower than 1.

For example, if measurement is originally 5, it will decay to 2.5, then 1.25 and then 0.625 so calling half_left(5); should return 0.625.

Make sure to use recursion (no loops)!

Your Answer:

Reset

Practice a different C++ exercise

Feedback

Your feedback will appear here when you check your answer.