Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ Converting Centimeters to Kilometers

    int centimeter;
    float meter,kilometer;

    cout<<"Input the distance in centimeter: ";
    cin>>centimeter;

    meter=centimeter*0.01;  //m=cm*0.01
    kilometer=centimeter/100000;    //d(km) = d(cm) / 100000

    cout<<"The Distance of "<<centimeter<<" centimeters in meters is "<<meter;
    cout<<" and "<<kilometer<<" in kilometers";
 
PREVIOUS NEXT
Tagged: #Converting #Centimeters #Kilometers
ADD COMMENT
Topic
Name
1+1 =