Computer Science, asked by khushnumakhanam71, 11 months ago

write a program to convert meter into kilometer in java
plzz give stepwise explanation with proper statement comma and semicolon plzz...​

Answers

Answered by anishasa
1

Answer:

To convert meters to kilometers divide meters by 1000

2000m = 2000 / 1000 = 2km

PROGRAM:

import java.util.Scanner;

public class Java

{

public static void main(String[] args)

      {

       Scanner in=new Scanner(System.in);

System.out.println("Enter the length to convert meter into Kilometer");

 double m=in.nextDouble();

double kiloMeter= m/1000;

System.out.println(m+" meter is equal to "+kiloMeter+"Kilometers");

          }

}

OUTPUT:

Enter the length to convert meter into kilometer

2

2.0 meter is equal to 0.002 kilometers

Similar questions