AllTheTimeWorld.com

algorithms mileageMPG Algorithm

MPG Algorithm

Gas Mileage Algorithm

Miles Per Gallon
The miles per gallon is the number of miles driven, divided by the number of gallons used. For example if you drive 100 miles and use 5 gallons, the MPG is 20.

 

Algorithm for Finding Miles per Gallon:

Now do the calculation.