Check BMI Category

This program checks BMI category based on BMI value.

Problem Statement

Write a Java program that prints BMI category based on BMI value.

Source Code

1 public class BMICategory {
2 public static void main(String[] args) {
3 double bmi = 22.5;
4 if(bmi < 18.5) {
5 System.out.println("Underweight - Eduinq");
6 } else if(bmi < 25) {
7 System.out.println("Normal weight - Eduinq");
8 } else if(bmi < 30) {
9 System.out.println("Overweight - Eduinq");
10 } else {
11 System.out.println("Obese - Eduinq");
12 }
13 }
14 }

Program Output

Normal weight - Eduinq

Explanation

The program uses BMI ranges to classify health categories. - If BMI is less than 18.5, it prints underweight. - If between 18.5 and 25, it prints normal weight. - If between 25 and 30, it prints overweight. - Otherwise, it prints obese. - This demonstrates how if-else ladders can classify continuous values into categories, useful in health applications. Conclusion: Shows how BMI categories can be implemented using if-else ladders.

Quick Links to Explore