Java program to calculate inch to meters

EX: Write Java program to calculate inch to meters. How to write java program which calculate inch to meters. Java program to calculate inch to meters.


Program to calculate inch to meters:


import java.util.Scanner;

public class InchestoMeter {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        double inch;
        double meter;

        System.out.println("Enter a value for inch: ");
        inch = sc.nextDouble();
        meter = inch * 0.0254;
        System.out.println(inch + " inch = " + meter + " meters");
    }

}
Above program shows the following output:

Enter a value for inch: 2000
2000.0 inch = 50.8 meters


No comments:

Post a Comment

If you have any doubts, please discuss here...👇