Question: C Programming Gas Mileage . Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline
C Programming Gas Mileage .
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful. Develop a program that will:
Allow the user to input the miles driven and gallons used for each tankful
Calculate and display the miles per gallon obtained for each tankful
Terminate input if the user enters -1 for the gallons used (the program should not ask for miles driven if the number of gallons entered is -1)
After processing all input information, calculate and print the combined miles per gallon obtained for all tankfuls
Be sure to check for divide by zero errors
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
