Advertisement
mominulkarim77

BMI Calculator

Mar 2nd, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int weight_pound, height_inch;
  5.     float result, bmi, height_square;
  6.  
  7.     printf("Enter your height in whole inch: ");
  8.     scanf("%d",&height_inch);
  9.     printf("Enter your weight in whole pound: ");
  10.     scanf("%d",&weight_pound);
  11.  
  12.     height_square=height_inch*height_inch;
  13.     result = weight_pound/height_square;
  14.     bmi = result * 703;
  15.  
  16.     printf("Your BMI is %0.1f\n",bmi);
  17.  
  18.     if (bmi<18.5)
  19.     {
  20.         printf("You are underweight");
  21.     }
  22.     else if (bmi >= 18.5 && bmi <= 24.9 )
  23.     {
  24.         printf("You are normal weight");
  25.     }
  26.     else if (bmi >= 25 && bmi <= 29.9)
  27.     {
  28.         printf("You are under weight");
  29.     }
  30.     else
  31.     {
  32.         printf("You are obese");
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement