C++ Program to Convert Centimeter to Meters and Kilometers

Write a C++ Program to Convert Centimeter to Meters and Kilometers with an example. This C++ code allows a user to enter centimeters and convert them to Meters and Kilometers.

#include<iostream>

using namespace std;

int main()
{
	float centimeter, meter, kilometer;
	
	cout << "\nPlease Enter the Length in Centimeters (cm)  =  ";
	cin >> centimeter;
	
	meter = centimeter / 100.0;
  	kilometer  = centimeter / 100000.0; 	 	
	
	cout << "\nLength in Meters = " << meter;
	cout << "\nLength in Kilometers = " << kilometer;
	
 	return 0;
}
C++ Program to Convert Centimeter to Meters and Kilometers 1

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.