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 reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 as gratuity and $11.5 as total.

Write a program that prompts the user to enter the min- utes (e.g., 1 billion), and displays the number of years and days for the minutes. For simplicity, assume a year has 365 days