luc022.c ​
Metadata ​
- Author — Amit Dutta
- Last updated — 12 Dec 2025
- License — MIT License (See the LICENSE file for details)
Problem Statement ​
Problem Statement
The Body Mass Index (BMI) is defined as ratio of weight of the person (in Kilograms) to square of the height (in meters). Write a program that receives weight and height, calculate the BMI, and reports the BMI catagory as per the following table. BMI Catagory BMI Starvation < 15 Anorexic 15.1 to 17.5 Underweight 17.6 to 18.5 Ideal 18.6 to 24.9 Overweight 25 to 25.9 Obese 30 to 39.9 Morbidly Obese >= 40
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include <stdio.h>
int main()
{
double weight, height, bmi;
printf("Enter your Weight (in Kilograms) and Height (in Meters) : ");
scanf("%lf %lf", &weight, &height);
bmi = weight / (height * height);
printf("\nCalculated BMI : %g", bmi);
if (bmi < 15)
printf("\nBMI Catagory : Starvation");
else if (bmi >= 15.1 && bmi <= 17.5)
printf("\nBMI Catagory : Anorexic");
else if (bmi >= 17.6 && bmi <= 18.5)
printf("\nBMI Catagory : Underweight");
else if (bmi >= 18.6 && bmi <= 24.9)
printf("\nBMI Catagory : Ideal");
else if (bmi >= 25 && bmi <= 25.9)
printf("\nBMI Catagory : Overweight");
else if (bmi >= 30 && bmi <= 39.9)
printf("\nBMI Catagory : Obese");
else if (bmi >= 40)
printf("\nBMI Catagory : Morbidly Obese");
else
printf("\nBMI Catagory : Unclassified");
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27