Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight in kilograms and dividing by the square of your height in meters. Write a program that prompts the user to enter a weight in pounds and height in inches and displays the BMI.

(Health application: BMI) Body Mass Index (BMI) is a measure of health on 
weight. It can be calculated by taking your weight in kilograms and dividing by the 
square of your height in meters. Write a program that prompts the user to enter a 
weight in pounds and height in inches and displays the BMI. Note that one pound is 
0.45359237 kilograms and one inch is 0.0254 meters.
#Beginner
In gcc c++ compiler using namespace std;


#include<iostream>
using namespace std;

int main()
{
const float KG_PER_POUND=0.45359237;
const float METER_PER_INCH=0.0254;
float pound,inch;
cout<<"Enter weigth in pounds :";
cin>>pound;
cout<<"Enter heigth in inces :";
cin>>inch;
float bmi=(float)(pound*KG_PER_POUND)/((inch*METER_PER_INCH)*(inch*METER_PER_INCH));
cout<<"BMI is "<<bmi;
return 0;
}
copy


Output
Enter weigth in pounds :95.5
Enter heigth in inces :50
BMI is 26.8573
[Program finished]
Explore our most popular Vitamins & supplements!
Best Sellers in Computers & Accessories

Need of Programmer

Need of Programmer

Comments

Popular posts from this blog

Write a program that reads in the radius and length of a cylinder and computes the area and volume using the following formulas: area = radius * radius * π volume = area * length

Write a program that prompts the user to enter two points (x1, y1) and (x2, y2) and displays their distance between them.The formula for computing the distance is

Area and perimeter of an equilateral triangle c++ program