Variables/Assignments: Driving costs
challenge activity
2.13.1: Driving costs.
Reset
Driving is expensive. The assignment is to have a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.
Ex: If the input is 20.0 3.1599, the output is:
1.57995 7.89975 63.198
Note: Real per-mile cost would also include maintenance and depreciation.