Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed 
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions