Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- float weight,height,bmi;
- int main()
- {
- printf(">Kind sir, could you please insert your weight and height, please?\n>Insert weight:\n");
- scanf("%f",&weight);
- printf(">Insert height(1.X meters)\n");
- scanf("%f",&height);
- bmi=weight/(height*height);
- if(weight<0 || height<=0)
- {
- printf("\n>Invalid user input\n\n");
- }
- else if(bmi==0)
- {
- printf("\n>Your BMI is...%f\n>Yeah sure pal\n\n",bmi);
- }
- else if(bmi<=20)
- {
- printf("\n>Underweight\n>BMI=%f\n\n",bmi);
- }
- else if(20<bmi && bmi<=25)
- {
- printf("\n>Normal\n>BMI=%f\n\n",bmi);
- }
- else if(25<bmi && bmi<=30)
- {
- printf("\n>Overweight\n>BMI=%f\n\n",bmi);
- }
- else
- {
- printf("\n>Obese\n>BMI=%f\n\n",bmi);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement