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
(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
1 2 |
/* <br /> * Author: AGHATISE OSAZUWA<br /> * Website: www.cscprogrammingtutorials.com<br /> *<br /> * Program to calculate a user's Body Mass Index (BMI)<br /> *<br /> */<br /><br />#include <stdio.h><br />int main ( ){<br /> int weight, height, bmi;<br /> printf("Enter your weight in pounds: ");<br /> scanf("%d", &weight);<br /> printf("Enter your height in inches: ");<br /> scanf("%d", &height);<br /> bmi = (weight * 703) / (height * height);<br /> printf("Your BMI value is %d.n", bmi);<br /> if (bmi < 18.5){<br /> printf("You are Underweight.n");<br /> }<br /> if (bmi >= 18.5 && bmi <= 24.9){<br /> printf("You are Normal.n");<br /> }<br /> if (bmi >= 25 && bmi <=29.9){<br /> printf("You are Overweight.n");<br /> }<br /> if (bmi >= 30){<br /> printf("You are Obese.n");<br /> }<br /> return 0;<br />}<br /> |
Click here to see other solutions to Deitel C How To Program exercises.
2 Comments
god bless u who ever made this program thank u
I thank God for this great resource of this website. in my journey to becoming a solution through software