You are on page 1of 3

Motaz Malik

Matric No. LSEZ4-09/15-00027

Lab Test 1
Programming 1

Body Mass Index (BMI)


Calculator
//Motaz Malik "LAB Test"

#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

int main()

{
float weight;
float height;
float bmi;
char response;

do
{
cout << "*****************************\n";
cout << "Please enter your weight (KG): ";
cin >> weight;
cout << "Please enter your height (Meters): ";
cin >> height;
bmi = (weight / pow(height,2)) ;
cout<<"\n";

29/3/2016
IPR1263

Motaz Malik
Matric No. LSEZ4-09/15-00027

Lab Test 1
Programming 1

cout << fixed << showpoint << setprecision(2);


cout<<"Your BMI is " << bmi << endl;

if (bmi < 18.5)


{
cout << "You are underweight!" << endl;
cout << "Eat more!!" << endl;
}
else if (bmi >= 18.5 && bmi <25)
cout << "You are normal!"<<endl;
else if (bmi >= 25 )
cout << "You are overweight!"<<endl;
else
cin.get();

cin.get();
cout << endl;

cout << "Would you like to enter the information again? ";
cin >> response;
}
while (toupper(response) == 'Y');
cout << "Okay, see you next time.." << endl;
return 0;
}

SNAP SHOTS OF BMI CALCULATOR

29/3/2016
IPR1263

Motaz Malik
Matric No. LSEZ4-09/15-00027

LOOPING OF PROGRAM

Lab Test 1
Programming 1

29/3/2016
IPR1263

You might also like