Computer Science, asked by mrohansh19, 10 months ago

Write a Java applet which accepts centimeters as input and displays it's meters and millimeters.Need urgently​

Answers

Answered by parveengakhar01560
0

Answer:

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 <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;

}

Java

Python3

C#

PHP

Output: Length in meter = 10 m Length in kilometer = 0.01 km

GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details

Similar questions