Wednesday, September 7, 2016

// // Leave a Comment

Body Mass Index Calculator Program

Question: We introduced the body mass index (BMI) calculator in Exercise 1.14. The formulas for calculating BMI are
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
/* 
 * Author: AGHATISE OSAZUWA
 * Website: www.cscprogrammingtutorials.com
 *
 * Program to calculate a user's Body Mass Index (BMI)
 *
 */

#include <stdio.h>
int main ( ){
    int weight, height, bmi;
    printf("Enter your weight in pounds: ");
    scanf("%d", &weight);
    printf("Enter your height in inches: ");
    scanf("%d", &height);
    bmi = (weight * 703) / (height * height);
    printf("Your BMI value is %d.\n", bmi);
    if (bmi < 18.5){
       printf("You are Underweight.\n");
    }
    if (bmi >= 18.5 && bmi <= 24.9){
       printf("You are Normal.\n");
    }
    if (bmi >= 25 && bmi <=29.9){
       printf("You are Overweight.\n");
    }
    if (bmi >= 30){
       printf("You are Obese.\n");
    }
    return 0;
}
Click here to see other solutions to Deitel C How To Program exercises.

0 comments:

Post a Comment


DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately.

Thanks.