# C Program to Convert Centimeter to Meter and Kilometer

C program to convert centimeters to meters and kilometers; Through this tutorial, we will learn how to convert centimeters to meters and kilometers in the c program.

## Algorithm to Convert Centimeter to Meter and Kilometer

Use the following algorithm to write a c program to convert centimeters to meters and kilometers; as follows:

• Start program.
• Take input centimeter and store in it.
• Convert centimeter to meters and kilometers by using this two formula
• meter = cm / 100.0;
• km = cm / 100000.0;
• Print meter and kilometer.
• Stop program.

## C Program to Convert Centimeter to Meter and Kilometer

```/* C Program to Convert Centimeter to Meter and Kilometer */

#include <stdio.h>

int main()
{
float cm, meter, km;

printf("\n Please Enter the Length in Centimeters  :  ");
scanf("%f", &cm);

meter = cm / 100.0;
km = cm / 100000.0;

printf("\n Length in Meters  = %.4f", meter);
printf("\n Length in Kilometers   = %.4f", km);

return 0;
}
```

The output of the above c program; as follows:

```Please Enter the Length in Centimeters  :  1000
Length in Meters  = 10.0000
Length in Kilometers   = 0.0100```