Question: loop termination by counter Loop Termination by Counter-Pseudocode: Write a pseudocode algorithm that calculates and prints the overall MPG (miles per gallon) for a series
Loop Termination by Counter-Pseudocode: Write a pseudocode algorithm that calculates and prints the overall MPG (miles per gallon) for a series of miles and gallon user inputs. Use a loop to repeatedly ask the user to enter a miles value and a gallons value. Within the loop, accumulate miles and gallons separately. Use counter loop to ensure that the loop repeats three times. The algorithm should generate a display of prompts, inputs, and final output that looks like this (italicized values are user inputs): Sample session: Enter miles: 10 Enter gallons: 1 Enter miles: 20 Enter gallons: 2 Enter miles 10 Enter gallons: 2 Overall MPG = 8 Provide a graceful response if the total gallons equals zero
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
