#include <stdio.h>

int main()
(
 float height, weight, bmi

 printf("Enter height in meter\n");
 scanf("%f", &height);

 printf("Enter weight in kg\n");
 scanf("%f", &weight);

 bmi = weight / (height * height);

 printf("Your BMI is %f\n", bmi);

 if(bmi < 15)
 (
      printf("Your BMI category is: Starvation\n");
      )
 else if(bmi >= 15.1 && bmi <= 17.5)
 (
      printf("Your BMI category is: Anorexic\n");
      )
 else if(bmi >= 17.6 && bmi <= 18.5)
 (
      printf("Your BMI category is: Underweight\n");
      )
 else if(bmi >= 18.6 && bmi <= 24.9)
 (
      printf("Your BMI category is: Ideal\n");
      )
 else if(bmi >= 25 && bmi <= 25.9)
 (
      printf("Your BMI category is: Overweight\n");
      )
 else if(bmi >= 30 && bmi <= 30.9)
 (
      printf("Your BMI category is: Obese\n");
      )
 else if(bmi >= 40)
 (
      printf("Your BMI category is: Morbidly Obese\n");
      )
 else
 (
      printf("Wrong entry\b");
 )

)

Recommended Answers

All 2 Replies

  1. Which line number is throwing the error?

  2. What if BMI si 15.04? There are other holes in the ranges you tested for.

commented: Also got undefined function printf and scanf errors +0
  1. As above.
  2. As above.
  3. Line 4 has a parentheses.
  4. Think again about your range tests. Why not test for bmi > = 15 on line 21?
  5. Think over all your ranges tests.
  6. Where is the closing bracket for main()?
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.