# Program to convert centimeter into meter and kilometer

Given length in centimeter, the task is to convert it into meter and kilometer.

Examples :

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

Formula to be used:

```1m = 100cm
1km = 100000cm```

## C++

 `// C++ program to convert centimeter ` `// into meter and kilometer ` `#include ` `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; ` `} `

## Java

 `// Java program to convert  ` `// centimeter into meter  ` `// and kilometer ` `import` `java.io.*; ` ` `  `class` `GFG ` `{ ` `    ``public` `static` `void` `main (String[] args)  ` `    ``{ ` `        ``double` `cm, meter, kilometer; ` `        ``cm = ``1000``; ` `     `  `        ``// Converting centimeter  ` `        ``// into meter and kilometer ` `        ``meter = cm / ``100.0``; ` `        ``kilometer = cm / ``100000.0``; ` `     `  `        ``System.out.println(``"Length in meter = "` `+ ` `                                    ``meter + ``"m"``); ` `         `  `     `  `        ``System.out.println(``"Length in Kilometer = "` `+  ` `                                   ``kilometer + ``"km"``); ` `    ``} ` `} ` ` `  `// This code is contributed by anuj_67. `

## Python3

 `# Python3 program to convert  ` `# centimeter into meter ` `# and kilometer ` `cm ``=` `1000``; ` ` `  `# Converting centimeter  ` `# into meter and kilometer ` `meter ``=` `cm ``/` `100.0``; ` `kilometer ``=` `cm ``/` `100000.0``; ` ` `  `# Driver Code ` `print``(``"Length in meter = "` `, ` `               ``meter , ``"m"``); ` `print``(``"Length in Kilometer = "``,  ` `             ``kilometer , ``"km"``); ` ` `  `# This code is contributed ` `# by mits `

## C#

 `// C# program to convert  ` `// centimeter into meter  ` `// and kilometer ` `using` `System; ` ` `  `class` `GFG ` `{ ` ` `  `// Driver Code ` `static` `public` `void` `Main () ` `{ ` `    ``double` `cm, meter, kilometer; ` `    ``cm = 1000; ` ` `  `    ``// Converting centimeter  ` `    ``// into meter and kilometer ` `    ``meter = cm / 100.0; ` `    ``kilometer = cm / 100000.0; ` ` `  `    ``Console.WriteLine(``"Length in "` `+  ` `                        ``"meter = "` `+ ` `                       ``meter + ``"m"``); ` `     `  ` `  `    ``Console.WriteLine(``"Length in "` `+  ` `                    ``"Kilometer = "` `+  ` `                  ``kilometer + ``"km"``); ` `} ` `} ` ` `  `// This code is contributed ` `// by ajit. `

## PHP

 ` `

Output:

``` Length in meter = 10 m
Length in kilometer = 0.01 km
```

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Improved By : vt_m, jit_t, Mithun Kumar

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.