Question: You are to write a simple C program that prompts the user for some information abou a car trip and then calculates some values based

 You are to write a simple C program that prompts theuser for some information abou a car trip and then calculates some 

You are to write a simple C program that prompts the user for some information abou a car trip and then calculates some values based on what's entered. Here's the details: Prompt the user to enter cost for a gallon of gas (a real number) miles traveled per gallon of gas for the car a whole number) speed traveled by the car for the trip in miles per hour a whole number) the duration of the trip in hours a real number) the distance traveled in miles between breaks a whole number calculate and display the following values the distance traveled (in miles) the amount of gas in gallons consumed the total fuel cost the number of breaks taken. This should be a whole number result. For example, if the trip is 425 miles long a break is taken every 100 miles, then the number of breaks taken is 4. Your program is to have nicely formatted input and similar to the following example as possible output as Enter the cost for a gallon of gas: $3.94 Enter the miles per gallon of gas for the car 22 Enter the speed traveled (miles/hour 65 Enter the time it took to get there hours 3.5 Enter the distance (miles) between breaks 100 The car traveled 227.5 miles and required 10.3409 gallons of gas. The total fuel cost for the trip was $40 2 breaks were taken

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!