-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathex10.c
36 lines (28 loc) · 1.26 KB
/
ex10.c
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
28
29
30
31
32
33
34
35
36
// 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
#include <stdio.h>
int main()
{
// Variables to store user input
double weight, height;
// Prompt user to enter weight in pounds and height in inches
printf("Enter your weight in pounds: ");
scanf("%lf", &weight);
printf("Enter your height in inches: ");
scanf("%lf", &height);
// Calculate BMI using the BMI formula
double bmi = (weight / (height * height)) * 703;
// Display the calculated BMI
printf("Your BMI is: %.2f\n", bmi);
// Display BMI categories
printf("BMI VALUES\n");
printf("Underweight: less than 18.5\n");
printf("Normal: between 18.5 and 24.9\n");
printf("Overweight: between 25 and 29.9\n");
printf("Obese: 30 or greater\n");
return 0;
}