That depends on the language. In C++ you might use the following:
#include<iostream>
using namespace std;
int main()
{
int miles, gas;
cout<<"Input the number of miles driven: ";
cin>>miles;
cout<<"Input the gallons of gas used: ";
cin>>gas;
cout<<"MPG: "<<miles/gas<<endl;
}
Of course when extracting user input you must always test the input is valid before operating upon it. If the user enters 0 gallons then you will end up with a divide by zero error.
number of miles driven on a tank / number of gallons to replenish that tank.
Miles driven divided by gallons used equals miles per gallon.
ten
Fill the fuel tank to the top and record the mileage. The next time you fill up record the mileage and number of gallons. Now divide the number of gallons into the number of miles driven since last fill up and you will have the mpg.
A basic simple way of calculating mileage is taking a look at the number of miles you have driven your car and divide it with the number of gallons your car consumed to travel that long.
6
It depends on you fuel economy. MPG means miles divided by gallons. Miles/Gallon. Take number of miles driven, divided by number of gallons to drive those miles. Flip over miles per gallon to get gallons per mile then multiply by dollars per gallon to get dollars per mile.
i Have no Idea please someone tell me
Divide the number of miles by the amount of fuel you used to go that distance. For example, if you traveled 400 miles and used 15 gallons of fuel, your fuel economy was -400 / 15 = about 26.6 mpg
That's entirely up to the programmer. A program could create 0 files or 50 million files (or any number in between).
To convert from US Gallons to Liters, multiply the number of Gallons by 3.7854 To convert from UK Gallons to Liters, multiply the number of Gallons by 4.54609188.
If there are x number of gallons per second, multiply that number by 60=gallons per minute.