write a program to convert centimetre into metre
Answers
Explanation:
Write a C program to input length in centimeter and convert it to meter and kilometer. How to convert length from centimeter to meter and kilometer in C programming. Length conversion program in C from centimeter to meter and centimeter to kilometer.
Example
Input
Enter length in centimeter = 1000
Output
Length in meter = 10 m
Length in kilometer = 0.01 km
Answer:
Input: Length in centimeter = 1000
Output:
Length in meter = 10 m
Length in kilometer = 0.01 km
Input: Length in centimeter =6540
Output:
Length in meter = 65.4 m
Length in kilometer = 0.0654 km
Explanation:
1m = 100cm 1km = 100000cm
C++
// C++ program to convert centimeter
// into meter and kilometer
#include <bits/stdc++.h>
using namespace std;
int main()
{
float cm, meter, kilometer;
cm = 1000;
// Converting centimeter into meter
// and kilometer
meter = cm / 100.0;
kilometer = cm / 100000.0;
cout << "Length in meter = " << meter << "m"
<< "\n";
cout << "Length in Kilometer = " << kilometer << "km"
<< "\n";
return 0;
}