In late 1990’s, the Department of Education started to get concern about the health of every public school students.
According to their research, a child performs well if he/she is getting the right nutrition their body needs. In order
solve this, they started a feeding program and monitors each student health records. Adapt the method of monitoring
the students’ Body Mass Index (BMi) helps the department to solve this concern . The body mass index (BMi) is
used to estimate the risk of weight-related problems based on a student’s height and mass. it was designed by the
mathematician Adolphe Quetelet in the 1800s and is sometimes referred to as the Quetelet index. The BMI is
computed as
In this formula, mass is in kilograms and height is in meters. The health risk associated with a BMI value are
• Underweight < 18.5
• Normal weight ≥ 18.5 and < 25
• Overweight ≥ 25 and < 30
• Obese ≥ 30
#include <iostream>
using namespace std;
double calculateBMI(double height, double weight) {
return weight / (height * height);
}
int main() {
double height, weight;
cout << "Enter your height (m): ";
cin >> height;
cout << "Enter your weight (kg): ";
cin >> weight;
double bmi = calculateBMI(height, weight);
cout << "Your BMI is " << bmi << endl;
if (bmi < 18.5) {
cout << "You are underweight" << endl;
}
else if (bmi < 25) {
cout << "You have a normal weight" << endl;
}
else if (bmi < 30) {
cout << "You are overweight" << endl;
}
else {
cout << "You are obese" << endl;
}
return 0;
}
Comments
Leave a comment