Apr 22, 2021

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:


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

Share This:    Facebook Twitter

0 comments:

Post a Comment

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