Write a C++ Program to Convert Kilometer to Meters Centimeters and Millimeters. Or C++ Program that accepts the Kilometer as an input and convert that Kilometer to Meters, Centimeters, and Millimeters.
#include<iostream> using namespace std; int main() { float millimeter, centimeter, meter, kilometer; cout << "\nPlease Enter the Length in Kilometers (km) = "; cin >> kilometer; meter = kilometer * 1000.0; centimeter = kilometer * 100000.0; millimeter = kilometer * 1000000.0; cout << kilometer << " Kilometers = " << meter << " Meters" << endl; cout << kilometer << " Kilometers = " << centimeter << " Centimeters" << endl; cout << kilometer << " Kilometers = " << millimeter << " Millimeters"; return 0; }
The output of converting KM to Meters, CM, and MM