Problem: metric converter

Write a program that convert a distance between the following 8 units of measure: m, mm,cm, mi, in, km,ft,yd. Use the below table:

Input measure Output measure
1 meter (m) 1000 millimeters (mm)
1 meter (m) 100 centimeters (cm)
1 meter (m) 0.000621371192 miles (mi)
1 meter (m) 39.3700787 inches (in)
1 meter (m) 0.001 kilometers (km)
1 meter (m) 3.2808399 feet (ft)
1 meter (m) 1.0936133 yards (yd)

You have three input lines:

  • First line: number for converting.
  • Second line: input unit.
  • Third line: output unit (the result).

Sample Input and Output

Input Output
12
km
ft
39370.0788
150
mi
in
9503999.99393599
450
yd
km
0.41147999937455

results matching ""

    No results matching ""