Body Mass Index Calculator In C


C programming Project From Deitel C how to program (Making a difference)

Create a BMI calculator application that reads the user’s weight in pounds and height in inches
(or, if you prefer, the user’s weight in kilograms and height in meters), then calculates and displays
the user’s body mass index. 

Also, the application should display the following information from the Department of Health and Human Services/National Institutes of Health so the user can evaluate his/her BMI:

BMI VALUES
Underweight: less than 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese: 30 or greater


One thing we generally need to know is that Bmi is universally expressed in Kg/M2 and heights in Meters  and the formula given by;

BMI weightInKilog rams
---------------------------------------------

heightInMeters × heightInMeters

It can also be expressed in Pounds and Inches with the formula given as;

BMI weightInPounds × 703
-------------------------------------------------
heightInInches × heightInInches

But to get started with the program we need to understand what the BMI values mean
Explanation of the above BMI VALUES

1.     If your BMI is less than 18.5, its falls within the underweight range.
2.     If your BMI is 18.5 to 25, it falls within the Normal weight
3.     If your BMI is 25.0 to 30, it falls within the Overweight range


4.     If your BMI is 30 or higher, if falls within the Obese range.

If you are new to C programming, you may need to download an IDE (Integrated Device Environment) which is used to write, compile, debug and run your programs. 
Am using CodeBlock: :IDE which is easy to use for new comers/professional programmers in programming and can be used to write programs both in C language and C++ language.


 (Body Mass Index Calculator) 

#include <stdio.h>
#include <stdlib.h>

int main()
{

    double mass
    double height
    double bmi; 

    printf("BMI CALCULATOR\n\n"); 
    printf("BMI VALUES:\n");
    printf("Underweight:Less than 18.5\nNormal:between 18.5 & 24.9\n");
    printf("Overweight: between 25 & 29\nObese: 30 or greater\n\n");

   
    printf("Enter Mass(in Kg):"); 
    scanf("%lf", &mass); 

    printf("Enter Height (in Meter):"); 
    scanf("%lf", &height); 


    bmi = mass/(height*height); 

    printf("\n\n"); 

    printf("YOUR BMI IS:%lf\n", bmi); 


    if(bmi >18.5){
        printf("Underweight is above the specification\n"); 
    }

    if(bmi >24.9){
        printf("Normal weight is above the specification\n");
    }

    if(bmi >29){
        printf("Overweight is above the specification\n"); 
    }

    if(bmi>30){
        printf("Obese Obese is above the specification\n"); 
    }

return 0

}

Comments

Post a Comment

Please feel free to comments if you have any ideas, questions and subjection concerning our post and programs

Popular posts from this blog

Adding two Integers in Java Application

Calculating Product, sum, difference, and quotient of Five Integers