Solution | URI Online Judge | 1014 Consumption

URI Online Judge | 1014

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

সল্যুশন্সঃ 
#include<iomanip>

using namespace std;

main()
{
    int X;
    float Y;

    cin >> X;
    cin >> Y;

    cout << fixed;
    cout << setprecision(3) << X/Y << " km/l" << endl;

    return 0;
}

আলোচনাঃ 
কোনো টপিক না বুঝলে অবশ্যই কমেন্টস করবেন। কোড কপি পেষ্ট না করে আগে বুঝুন দেন নিজে নিজে করুন। কোডিং এর মজা টা বুঝবেন।

Comments

Popular posts from this blog

Solution - Codeforces Problem 327B - Hungry Sequence

Solution - Timus Problem 1293. Eniya

Solution - Timus Problem 1409. Two Gangsters