bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / letusc / luc022.c

luc022.c (1502B)


      1 /* The Body Mass Index (BMI) is defined as ratio of  weight of the
      2 person (in Kilograms) to square of the height (in meters).
      3 Write a program that receives weight and height, calculate the BMI, and reports
      4 the BMI catagory as per the following table.
      5     BMI Catagory            BMI
      6     Starvation              < 15
      7     Anorexic                15.1 to 17.5
      8     Underweight             17.6 to 18.5
      9     Ideal                   18.6 to 24.9
     10     Overweight              25 to 25.9
     11     Obese                   30 to 39.9
     12     Morbidly Obese          >= 40
     13 */
     14 /* Let Us C, Chap- 4, Page - 72, Qn No.: D(d) */
     15 
     16 #include <stdio.h>
     17 
     18 int main()
     19 {
     20     double weight, height, bmi;
     21     printf("Enter your Weight (in Kilograms) and Height (in Meters) : ");
     22     scanf("%lf %lf", &weight, &height);
     23     bmi = weight / (height * height);
     24     printf("\nCalculated BMI : %g", bmi);
     25     if (bmi < 15)
     26         printf("\nBMI Catagory : Starvation");
     27     else if (bmi >= 15.1 && bmi <= 17.5)
     28         printf("\nBMI Catagory : Anorexic");
     29     else if (bmi >= 17.6 && bmi <= 18.5)
     30         printf("\nBMI Catagory : Underweight");
     31     else if (bmi >= 18.6 && bmi <= 24.9)
     32         printf("\nBMI Catagory : Ideal");
     33     else if (bmi >= 25 && bmi <= 25.9)
     34         printf("\nBMI Catagory : Overweight");
     35     else if (bmi >= 30 && bmi <= 39.9)
     36         printf("\nBMI Catagory : Obese");
     37     else if (bmi >= 40)
     38         printf("\nBMI Catagory : Morbidly Obese");
     39     else
     40         printf("\nBMI Catagory : Unclassified");
     41     return 0;
     42 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror