Calculate the cost of gas.
The calculation is based on average miles per gallon, distance, and the cost of one gallon of gas. It includes a destination distance, and in case you take a different road back, the return distance. In case there is a price diffrence, an option field to add the price for one gallon of gas to calculate the cost nof the return trip. If your trip takes multiple fill-ups, you will have to calculate the average cost you pay for a gallon of gas.
The average miles per gallon is 23 The price of one gallon of gas at the start of the trip is $3.34 The distance to your destination is 248.5 miles The return trip distance is 248.5 miles The price of one gallon of gas at the start location of your return trip is $4.11
Calculate the amount of gas needed for the way trip;
248.5 ÷ 23 = 10.8
It takes 10.8 gallons of gas to get to your destination.
Calculate the cost of gas for the way trip;
3.34 * 10.8 = $36.07
The first leg of your trip will cost $36.07 on gas.
The return trip is the same distance and uses the same fuel amount, but the gas price differs. Calculate the cost of the gas needed for the return trip;
4.11 * 10.8 = $44.39
The return trip will cost $44.39 on gas.