Question
10a.The following data were collected on a recent automobile trip: Write a C program that accepts a mileage and gallons value and calculates the miles-per-gallon
10a.The following data were collected on a recent automobile trip:
Write a C program that accepts a mileage and gallons value and calculates the miles-per-gallon (mpg) achieved for that segment of the trip. The mpg is obtained as the difference in mileage between fill-ups divided by the number of gallons of gasoline received in the fill-up.
Modify the program written for Exercise 10a to additionally compute and display the cumulative mpg achieved after each fill-up. The cumulative mpg is calculated as the difference between each fill-up mileage and the mileage at the start of the trip divided by the sum of the gallons used to that point in the trip.
Mileage 22,495 22,841 23,185 23,400 23,772 24,055 24,434 | 24,804 | 25,276 Gallons Full tank 12.2 11.3 10.5 11.0 12.2 14.7 14.3 15.2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started