Table of Contents

Consumption

Adapted by Neilor Tonin, URI  Brazil | Timelimit: 1

Calculate a car’s average consumption being provided the total distance traveled (in Km) and the spent fuel total (in liters).

Input

The input file contains two values: one integer value representing the total distance (in Km) and the second one is a floating point number Y  representing the spent fuel total, with a digit after the decimal point.

Output

Present a value that represents the average consumption of a car with 3 digits after the decimal point, followed by the message “km/l”.

Input SampleOutput Sample
500
35.0
14.286 km/l
2254
124.4
18.119 km/l
4554
464.6
9.802 km/l

Solution

#include <stdio.h>
int main()
{
   int X;
   float Y;
   scanf("%d",&X);
   scanf("%f",&Y);
   printf("%.3f km/l\n",X/Y);
    return 0;
}
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest
Share on whatsapp
WhatsApp
Share on email
Email
Md. Nurnobi Hosen
Md. Nurnobi Hosen

Student of Computer Science and Engineering at Daffodil International University,Main Campus ,Dhanmondi.
Web and App Developer also expart of wordpress customization

All Blog Posts »
Subscribe
Notify of
guest
3 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
oprol evorter
oprol evorter
December 9, 2019 10:26 PM

This blog is definitely rather handy since I’m at the moment creating an internet floral website – although I am only starting out therefore it’s really fairly small, nothing like this site. Can link to a few of the posts here as they are quite. Thanks much. Zoey Olsen

oprol evorter
oprol evorter
December 11, 2019 3:14 AM

Hello, Neat post. There’s an issue with your website in web explorer, could test this?K IE nonetheless is the marketplace chief and a big portion of other people will leave out your magnificent writing due to this problem.

juridik
juridik
February 26, 2020 7:43 AM

Yes! Finally something about bodelning.

3
0
Would love your thoughts, please comment.x
()
x