Program that asks the user to enter the number of miles


You have to evaluate and show the miles-per-gallon value. Confine your output to 1 decimal place.

Question- Write a C - program that asks the user to enter the number of miles traveled and the number of gallons of gasoline consumed. It should then calculate and display the miles-per-gallon value. Confine your output to 1 decimal place.

Next, using the fact that one gallon is about 3.785 liters and one mile is about 1.609 kilometers, it should convert the mile-per-gallon value to a liters-per-100-km value, the usual European way of expressing fuel consumption, and display the result, showing 2 decimal places. Use symbolic constants (using const or #define) for the two conversion factors in your program.

Example output (user input is bold):

Please enter the number of miles:

Please enter the number of gallons of gasoline consumed:

0.5 Your fuel consumption is 16.4 mile-per-gallon.

In the European scheme it is 14.34 liters-per-100-km.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Program that asks the user to enter the number of miles
Reference No:- TGS0966309

Expected delivery within 24 Hours