You are to develop a java program allows the user to enter a
You are to develop a java program allows the user to enter a length in meters and centimeters, and display the length converted to feet and inches. There are 2.54 centimeters in an inch. Display the result with two decimal places of precision.
Solution
import java.util.Scanner;
 public class length {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan = new Scanner(System.in);
        System.out.print(\"Enter the number of meters in length:\");
        int a = scan.nextInt();
        System.out.print(\"Enter the number of centemeters in length:\");
        int b = scan.nextInt();
       
        double len = 100*a+b;
        int inch = (int) (len/2.54);
       
        System.out.println(\"Number of feets in length:\"+inch/12);
        System.out.println(\"Number of inches in length:\"+inch%12);
    }
}

