Question: Write a C + + program to compute miles per gallon given miles driven and gallons of gas used. It is taken from the Programming

Write a C++ program to computemiles per gallongivenmiles drivenandgallons of gas used.It is taken from the Programming Challenges section in your text: P.83, #10. The problem specification is as follows:
===============================
[Miles per Gallon]
A car holds 15 gallons of gasoline and can travel 375 miles before refueling. Write a program that calculates the number of miles per gallon the car gets. Display the result on the screen.
Hint: Use the following formula to calculate miles per gallon (MPG):
MPG 5 Miles Driven/Gallons of Gas Used
=====================================
This is designed to help you learn how to write a simple C++ program and use a C++ expression to apply a formula to obtain the answer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!