Conversion between Metric and Nonmetric Units Solution

Conversion between Metric and Nonmetric Units
English Metric
1 Ounce (oz) 28.3495 grams (g)
1 pound (lb) 453.6 grams (g)
1 inch(in) 2.54 centimeter (cm)
1 foot (ft) 30.5 centimeter (cm)
1 mile (mi) 1.609 kilometer (km)

Write a unit conversion program that converts English units to Metric using the conversion table given above. Ask the user from which unit they want to convert ( oz, lb, in, ft, mi) and which unit they want to convert to (g, kg, cm, and km). Reject incompatible conversions such as gal - km, ask for the value to be converted; then display the result. Here is an example:
Convert from? gal
Convert to? ml
Value? 2.5
2.5 gal = 9462.5 ml
Powered by