Python program to convert Centimeters to Meters and Kilometers

print("Enter the length in centimeter::")
c, m, k = float(input()), 0, 0
# c = centimeter
# m = meter
# k = kilometer
# Convert centimeter into meter and kilometer
m = (float)(c / 100)
k = (float)(c / 100000)
# Output
print("Length in Meter      = ", m, " meter")
print("Length in Kilometer  = ", k, " kilometer")

OUTPUT:

Enter the length in centimeter::
100
Length in Meter         =  1.0  meter
Length in Kilometer  =  0.001  kilometer

Leave a Comment