[URI Online Judge] – 1017 – Fuel Spent

Little John wants to calculate and show the amount of liters of fuel spent on a trip, using a car that does 12 Km/L. For this, he would like you to help him through a simple program. To perform the calculation, you have to read time spent (in hours) and the same average speed (km/h). This way you can get distance and then calculate how many liters would be needed. Print the result rounded to three decimal places.

Input

The input file contains two integers. The first one is the time spent in the trip (in hours). The second one is the average velocity during the trip (in Km/h).

Output

Print how many liters would be needed to do this trip, with three digits after the decimal point.

Sample Input Sample Output
10
85
70.833
2
92
15.333
22
67
122.833

Solution:

#include <cstdio>
#include <cmath>
int main(){
 float h, s;
 scanf("%f", &h);
 scanf("%f", &s);
 printf("%.3f\n", h * s / 12.0);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s