{
Assignment 1, Program 2
name: "Gas mileage computer"
by: Ben Weir
Modified: Sept. 11, 1996
this program gets information about a car trip
and computes the total cost of gas needed for that
trip.
}
program GasCost (input, output);
var
distance, {number of miles traveled}
mpg, {miles per gallon of the car}
gas_price, {price of gasoline}
total_cost: {total cost of trip}
real;
begin
Write('How many miles did you drive? '); {get all the input}
readln(distance);
write('How many miles per gallon does your car get? ');
readln(mpg);
Write('How much does a gallon of gas cost? ');
readln(gas_price);
total_cost := (distance / mpg) * gas_price; {perform calculation}
writeln; {print it out}
writeln('Total cost: $', total_cost: 1: 2);
write('Press enter');
readln;
end.
               (
geocities.com/siliconvalley/park)                   (
geocities.com/siliconvalley)