According to the National Heart, Lung, and Blood Institute of the National Institutes of Health, body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. It is used to monitor one's health by determining whether one is underweight, overweight, has normal weight or is obese. It is computed based as follows (when using standard weight in pounds and height in inches):
BMI = 703 x (weight/(height2))
Note: For this problem, you need to format the output to print the appropriate number of decimal places. You need to use System.out.format (Read: https://docs.oracle.com/javase/tutorial/java/data/numberformat.html)
public class Sol {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter your mass and height");
double mass = s.nextDouble();
double height = s.nextDouble();
System.out.printf("Your BMI equals to %.10f", 703 * (mass / height));
}
}
Comments
Leave a comment