Java program to calculate foot to centimeters

 EX: Write a java program to calculate foot to centimeters. How to write a java program to calculate foot to centimeters. Java program to calculate foot to centimeters.


Program to calculate foot to centimeters:


import java.util.Scanner;

public class FoottoCm {

        public static void main(String[] args){

            Scanner sc = new Scanner(System.in);

            System.out.println("Enter a value for foot: ");
            double foot = sc.nextDouble();
            double cm = foot * 30.48;
            System.out.println(foot + " foot = " + cm + " Centimeters");
        }
}

Above java program shows the following output:

Enter a value for foot: 6
6.0 foot = 182.88 centimeters

No comments:

Post a Comment

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