/* Convert Kilometer To Meter.*/
//programming789.blogspot.com
import java.util.Scanner;
public class Convert
{
public static void main(String[] args) {
int m = 1000;
System.out.println("Enter Kilometer: ");
double km;
Scanner reader = new Scanner(System.in);
km = reader.nextDouble();
double meter=km*m;
System.out.println("meter:-"+meter);
}
}
//programming789.blogspot.com
import java.util.Scanner;
public class Convert
{
public static void main(String[] args) {
int m = 1000;
System.out.println("Enter Kilometer: ");
double km;
Scanner reader = new Scanner(System.in);
km = reader.nextDouble();
double meter=km*m;
System.out.println("meter:-"+meter);
}
}
● Save the file as Convert.java.
● When the program is run, the following output is displayed:
Ouput:
>java Convert
Enter Kilometer:
12.5
meter:-12500.0
Enter Kilometer:
12.5
meter:-12500.0