SHARE
TWEET

Untitled

a guest Oct 17th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. float weight,height,bmi;
  4. int main()
  5. {
  6.     printf(">Kind sir, could you please insert your weight and height, please?\n>Insert weight:\n");
  7.     scanf("%f",&weight);
  8.     printf(">Insert height(1.X meters)\n");
  9.     scanf("%f",&height);
  10.     bmi=weight/(height*height);
  11.     if(weight<0 || height<=0)
  12.     {
  13.         printf("\n>Invalid user input\n\n");
  14.     }
  15.     else if(bmi==0)
  16.     {
  17.         printf("\n>Your BMI is...%f\n>Yeah sure pal\n\n",bmi);
  18.     }
  19.     else if(bmi<=20)
  20.     {
  21.         printf("\n>Underweight\n>BMI=%f\n\n",bmi);
  22.     }
  23.     else if(20<bmi && bmi<=25)
  24.     {
  25.         printf("\n>Normal\n>BMI=%f\n\n",bmi);
  26.     }
  27.     else if(25<bmi && bmi<=30)
  28.     {
  29.         printf("\n>Overweight\n>BMI=%f\n\n",bmi);
  30.     }
  31.     else
  32.     {
  33.         printf("\n>Obese\n>BMI=%f\n\n",bmi);
  34.     }
  35.  
  36.     return 0;
  37.  
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top