The body mas index (BMI) is defined as ratio of the weight of the person (in kelometer) to the square oef height (in meters) . write a program that recieve weight and height calculate the BMI and report the BMI category as per the following table .

 BMI category

BMI

Starvation

<15

Anorexic

15.1 to 17.5

Under weight

17.6 to 18.5

Ideal

18.6 to 24.9

Over weight

25 to 25.8

Obese

30 to 30.9

Morbidly obese

   >=40

 

 #include<stdio.h>

#include<conio.h>

#include<math.h> 

int main()

{

float weight ,height ,BMI;

//Weight should be in kilograms

// /Height should be in meter

printf("Enter the weight of person:");

scanf("%f",&weight);

printf("Enter the height of person:");

scanf("%f",&height);

BMI=weight/pow(height,2);

printf("The BMI of person is :%2f\n",BMI);

if(BMI>0&&BMI<=15)

printf("BMI category is starvation :");

else if(BMI>=15.1&&BMI<=17.5)

 printf("BMI category is Anorexic: ");

else if(BMI>17.6&&BMI<=18.5)

printf("BMI category is underweight:");

 else if(BMI>18.6&&BMI<=24.9)

 printf("BMI category is Ideal:");

 else if(BMI>25&&BMI<=25.9)

printf("BMI category is overweight:");

 else if(BMI>30&&BMI<=30.9)

 printf("BMI category is obese:");

else if (BMI>=40)

printf("BMI category is morbidly obese:");

return 0;

}

 output--Enter the weight of person:45

 Enter the height of person:1.5

 The BMI of person is :20.000

BMI category is Ideal

 



 related program--

1.A certain grade of steel is graded according to following condition: (i) Hardness must be greater than 50. (ii)carbon content must be less than 0.7 (iii)Tensile strength must be greater than 5600. the grades as follows: grade is 10 if all three condition are met, Grade is 9 if conditions (i)and (ii) are met , Grade is 8 if condition (ii) and (iii) are met , Grade is 7 if condition (i) and (iii) are met, Grade is 6 if only one condition is met , Grade is 5 if none of the conditions are met . write a program which will require the user to give values of hardness , carbon content and tensile strength of the steel under consideration and output the grade of steel

2..A digital world colors are specified in Red ,Green ,Blue(RGB) format with value of (R,G,B) varying on integers scale from 0 to 255 in point publishing the colors are mentioned in cyan, magenta - yellow black (CMYK) format ,with value of C,M,Y and k varying on real scale from 0.0 to 1.0 write the program to convert RGB colors to CMYK as per the following formula.. White=max(Red/255,Green/255,Blue/255), cyan=(white-Red/255)/white Magenta=(white -Green/255)/white black = 1-white. note that if RGB value are all 0 then the cmy values are all 0 and the k value is 1. 

3..if the three of triangle are entered through the keyboard write a program to check whether the triangle is isosceles equilateral ,scalene or right angle triangle

Comments

Popular posts from this blog

class with array in c++ (memory allocatin & using array in classes)

constructor with default arguments

constructor overloading in c++ programming