Java script program to enter length in centimetre and convert it into meter and kilometre.

Java script program to enter length in centimetre and convert it into meter and kilometre.

Java script program to enter length in centimetre and convert it into meter and kilometre.

java script   program to enter the length in centimeter and convert it into meter and kilometer. In this article, you will learn how to convert the centimeter into meter and kilometer in javascript language.

Formula

				
					1m = 100cm

1km = 100000cm
				
			

Code

				
					 <script>
        let cm, m, km;
        cm= parseInt(prompt("Enter CM"))
        m=cm/100
        alert("MEters =" +m)
        km=m/1000
        alert("Kilometer= "+ km)
       

    </script>
				
			
Spread the love