Question: Learn to write do - while loops. Assignment: In developing an algorithm for a new fitness app, you're tasked with calculating the cumulative elevation gain
Learn to write dowhile loops.
Assignment: In developing an algorithm for a new fitness app, you're tasked with calculating the cumulative elevation gain for a step stairclimbing challenge. Each step increases in height exponentially, starting from meter for the first step and doubling the height increase for each subsequent step.
Given long variables totalElevation and step that have already been declared, use a dowhile loop to calculate the total elevation gain over steps, with each step's elevation gain being twice the previous step's gain starting from meter for the first step Store this cumulative elevation in totalElevation.
For example, the elevation gain sequence will start etc., doubling each time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
