Answer: There is something called the conversion factor.
For example, 1km is 1000 meters, so the conversion factor that goes from km to meters, is :

And if you have a quantity expressed in kilometers, and want to write it in meters, you multiply it for the conversion factor.