Decode School

Decode School - The School for Problem Solvers
Welcome to My Blog.
Need Assignment / Project Guidance (or) Training in Python?

Java Program to Meters to Kilo Meters

Get meter m from user and find kilometer km

Sample Input 1:


Sample Output 1:


Program or Solution

import java.util.*;
class MtsToKm
      public static void main(String args[])
		float km,metres;
           Scanner sc=new Scanner(;
           System.out.println("Enter The Input 1:");
           System.out.println("The Output 1 Is:\n"+km);


Program Explanation

Get meter mts as input (using scanner class)

Calculate kilometer km by dividing meter mts by 1000.

(km=mts/1000, 1000 meter is equal to 1 kilometer)