Algorithm


Problem Name: beecrowd | 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 X representing the total distance (in Km) and the second one is a floating point number 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 Sample Output Sample

500
35.0

14.286 km/l

 

2254
124.4

18.119 km/l

 

4554
464.6

9.802 km/l

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

int main()
{
 double a, b;

 scanf("%lf %lf", &a, &b);

 printf("%.3lf km/l\n", a / b);

 return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
500
35.0

Output

x
+
cmd
14.286 km/l

#2 Code Example with C++ Programming

Code - C++ Programming




#include <cstdio>

int main()
{
 double a;
 double b;

 scanf("%lf", &a);
 scanf("%lf", &b);

 printf("%.3lf km/l\n", a / b);

 return 0;
}


Copy The Code & Try With Live Editor

Input

x
+
cmd
2254
124.4

Output

x
+
cmd
18.119 km/l

#3 Code Example with Java Programming

Code - Java Programming


import java.util.Scanner;


public class Main {

 public static void main(String[] args) {
  double a, b;

  Scanner sc = new Scanner(System.in);
  a = sc.nextDouble();
  b = sc.nextDouble();

  System.out.printf("%.3f km/l\n", a / b);

 }

}
Copy The Code & Try With Live Editor

Input

x
+
cmd
4554
464.6

Output

x
+
cmd
9.802 km/l

#4 Code Example with Python Programming

Code - Python Programming


distancia = int(input())
combustivel = float(input())

consumo = distancia / combustivel

print("%0.3f km/l" %consumo)
Copy The Code & Try With Live Editor

Input

x
+
cmd
500
35.0

Output

x
+
cmd
14.286 km/l

#5 Code Example with C# Programming

Code - C# Programming


printf

km/l\n", a / b
Copy The Code & Try With Live Editor

Input

x
+
cmd
500
35.0

Output

x
+
cmd
14.286 km/l

Demonstration


Previous
#1012 Beecrowd Online Judge Solution 1012 Average 2 - Solution in C, C++, Java, Python and C#
Next
#1017 Beecrowd Online Judge Solution 1017 Average 2 - Solution in C, C++, Java, Python and C#