C Program to Convert Centimeter to Meter and Kilometer

Write a C Program to Convert Centimeter to Meter and Kilometer with an example.

C Program to Convert Centimeter to Meter and Kilometer

This program allows the user to enter the length in Centimetres, and then convert the length into Meters, and Kilometre in C Programming.

1 Meter = 100 Centimeters
1 Kilometer = 100000 Centimeters

/* 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;
}
C Program to Convert Centimeter to Meter and Kilometer Example