Skip to main content

Java program to calculate BMI (Body Mass Index)


import java.util.Scanner;

public class BMI_Calc
{
        public static void main(String args[])
        {
                double wt, ht,bmi;

                Scanner sc=new Scanner(System.in);

                System.out.print("Enter your wieght in pounds: ");
                wt=sc.nextDouble();
                System.out.print("\nEnter your hieght in inches: ");
                ht=sc.nextDouble();

                wt=wt*0.45359237;
                ht=ht*0.0254;

                bmi=wt/(ht*ht);
                System.out.print("\n\nBMI = " + bmi);
        }
}

Comments