Example 4: Weight Conversions

Learn how to convert weight in kilograms to various other units.

Problem

Write a program that takes the weight of a commodity in kg, and convert it into the following units:

  • Grams
  • Quintals
  • Metric Tonnes
  • Pounds

Print the result of all the above conversions on the console in three decimal places.

Example

Input (kilograms) Output (grams, quintal, tonnes, pounds)
45.87 45870.000, 0.459, 0.046, 101.097

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Note: Do not change the print statement given in the exercise.

Get hands-on with 1400+ tech skills courses.