Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C program compatible with Microsoft visual studio: Include system pause Write a

ID: 3701116 • Letter: C

Question

C program compatible with Microsoft visual studio: Include system pause
Write a program to compute the Mileage given by a vehicle.
Mileage = (new_odometer – old_odometer)/(gallons_gas)
Program illustrating how ‘for’ loop works. C program compatible with Microsoft visual studio: Include system pause
Write a program to compute the Mileage given by a vehicle.
Mileage = (new_odometer – old_odometer)/(gallons_gas)
Program illustrating how ‘for’ loop works. C program compatible with Microsoft visual studio: Include system pause
Write a program to compute the Mileage given by a vehicle.
Mileage = (new_odometer – old_odometer)/(gallons_gas)
Program illustrating how ‘for’ loop works.

Explanation / Answer

#include #include #include using namespace std; int main() { double old_odometer, new_odometer, totalMilege, averageMPG, gallons, ppg, totalPPG, countPPG, averagePPG, mpd; old_odometer = 0; new_odometer = 0; totalMilege = 0; char advance; advance = 'y'; while (advance == 'y' || advance == 'Y') { printf(" Enter the old odometer reading"); scanf("%d",old_odometer); while (old_odometer