C++ program to calculate Body Mass Index (BMI) with pounds and inches

A simple C++ program to calculate Body Mass Index (BMI) with pounds and inches. The BMI is calculated by dividing a person’s weight in kilogrammes by the square of their height in metres.

A high BMI indicates a high level of body fatness. BMI detects weight categories that may cause health concerns, however it does not diagnose an individual’s body fatness or health.

#include<iostream>
using namespace std;
int main()
{
float bmi,w,h;
cout<<"enter weight in pounds";
cin>>w;
cout<<"enter height in inches";
cin>>h;
bmi=(w*703)/(h*h);
cout<<"Your BMI is : "<<bmi<<endl;
if(bmi>25)
cout<<"Overweight";
else if(bmi<25 && bmi>18.5)
cout<<"Optimal";
else
cout<<"Underweight";
return 0;
}

Output:

enter weight in pounds45
enter height in inches170
Your BMI is : 1.09464
Underweight

How to calculate the bmi of person in c++ program using formula

What is the formula for calculating BMI? The BMI is a straightforward calculation based on a person’s height and weight. BMI = kg/m2, where kg represents a person’s weight in kilogrammes and m2 represents their height in metres squared. Overweight is defined as a BMI of 25.0 or higher, while the healthy range is 18.5 to 24.9.

Why BMI is important

BMI is a measurement of body fat and a reliable indicator of your risk of diseases associated with excess body fat. Heart disease, high blood pressure, type 2 diabetes, gallstones, respiratory issues, and some malignancies are all linked to a high BMI.

What is float value in c++

A number followed by a decimal point is assumed to be a floating-point constant in C++. As a result, it is assumed that 2.5 is a floating point number. Even if the number to the right of the decimal point is zero, this decimal-point rule holds. As a result, 3.0 is also a floating point number.

A floating-point or float variable is a type of variable in programming that is used to hold floating-point number values. A floating-point number is one in which the decimal point can “float” within the number rather than being in a fixed position.