URI Online Judge Solution| 1014 Consumption

Solution:Though car consumption means http://www.racq.com.au/cars-and-driving/cars/owning-and-maintaining-a-car/fuel-saving-tips/measuring-fuel-consumption that desribe here’s broadly

The following formula is used to calculate fuel consumption in litres / 100kms, the most commonly used measure of fuel consumption.


Example a car uses 65 litres to travel 500km

(65 X 100) / 500 = 13

(Litres used X 100) / km travelled = Litres per 100km.


 

but in the problem it is saying that medium of the car consumption with 3 digit after the decimal point so we have just divided the integer x and float y and got the answer. 🙂

#include<iostream>
#include<cstdio>
#include<cstdlib>
int main()
{
    float x,y,z;
scanf("%d\n %d",&x,&y);
z=x/y;
printf("%.3f km/l\n",z);
return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *