Professional Documents
Culture Documents
CM To M and KM Conversion
CM To M and KM Conversion
Example
Input
Enter length in centimeter = 1000
Output
Length in meter = 10 m
Length in kilometer = 0.01 km
Required knowledge
Arithmetic operators, Data types, Variables and expressions, Basic input/output
#include <stdio.h>
int main()
{
float cm, meter, km;
return 0;
}
%.2f is used to print the fractional value up to two decimal places. You can also
use %f to print by default up to 6 decimal places.
Output
Enter length in centimeter: 1000
Length in Meter = 10.00 m
Length in Kilometer = 0.01 km