PROGRAMMING TECHNIQUE I

ASSIGNMENT 2

Text

//MD SIRAJUM MUNEER(A20EC4035)//
//LIM LI TING(A20EC5008)//
//MUHAMMAD DAFA RAYHAN YASSER//
#include <iostream>
#include<conio.h>
#include<iomanip>
#include<cmath>
using namespace std;
double getBMI (double weight, double height)
{
double bmi= (weight * 703) / (height * height);
return bmi;

}

void getStatus (double bmi)
{
cout << "\nYOUR BMI VALUE IS : " << bmi<<endl;
if(bmi<18.5){
cout<<"\nCategory : underweight"<<endl;
cout<<"-------------------------"<<endl;
}else if(bmi>18.5 && bmi<=24.9){
cout<<"\nCategory : Normal weight"<<endl;
cout<<"-------------------------"<<endl;
}else if(bmi>25 && bmi<=29.9){
cout<<"\nCategory : Overweight"<<endl;
cout<<"-------------------------"<<endl;
}else if(bmi>30){
cout<<"\nCategory : Obese"<<endl;
cout<<"-------------------------"<<endl;
}
}


int main()
{
double weight=0.0, height=0.0, bmi;
int n;
cout<<"How many students ? :";
cin>>n;
for(int i=1; i<=n;i++)
{
cout<<"\nENTER DETAILS OF "<<i<<"STUDENT" <<endl;

cout << "\nENTER YOUR WEIGHT IN POUNDS: ";
cin >> weight;
cout << "ENTER YOUR HEIGHT IN INCHES: ";
cin >> height;

bmi = getBMI(weight, height);

getStatus(bmi);
}

getch();
}