Distance to fuel cost
For each trip, fuel used equals travel distance divided by MPG. Cost then equals that fuel quantity multiplied by the price per gallon. Keep the units consistent: miles with miles per gallon, plus a per-gallon fuel price. The same arithmetic applies to gasoline and diesel; the entered price and the vehicle's fuel economy distinguish them.