2
 #include<stdio.h> int main () {  //declare variables  float W,H,BMI;  printf("Please enter your weight in kilogram\n");  scanf("%f",&W);  printf("Please enter your height in meter\n");  scanf("%f",&H);  //equation  BMI=(W/(H*H));  printf("Your BMI is %f\n",BMI);  if (BMI<20)  printf("you are underweight\n");  else if (BMI>=20)  printf("you are less obese\n");  else if (BMI=23)  printf("you are in ideal weight\n");  else if (BMI>=23)  printf("you are obese\n");  else if (BMI>25)  printf("you are overweight\n");  return 0; }

BMI C coding

Embed Size (px)

Citation preview

7/21/2019 BMI C coding

http://slidepdf.com/reader/full/bmi-c-coding 1/1

#include<stdio.h>int main (){  //declare variables  float W,H,BMI; 

printf("Please enter your weight in kilogram\n");  scanf("%f",&W);  printf("Please enter your height in meter\n");  scanf("%f",&H); 

//equation  BMI=(W/(H*H));  printf("Your BMI is %f\n",BMI); 

if (BMI<20)  printf("you are underweight\n");  else if (BMI>=20)  printf("you are less obese\n");  else if (BMI=23)  printf("you are in ideal weight\n");  else if (BMI>=23)  printf("you are obese\n");  else if (BMI>25)

  printf("you are overweight\n"); return 0;

}