title: How to calculate BMI using function?
body: <p>Calculate the body mass index.
  Body mass index compares your weight to your height, and is calculated by dividing your weight in kilograms by your height in meters squared. It gives you an idea of whether you're underweight, a healthy weight, overweight, or obese for your height. </p>
  
  <p>Body Mass Index Categories: </p>
  
  <ol>
  <li>Underweight = &lt;18.5  </li>
  <li>Normal weight = 18.5–24.9  </li>
  <li>Overweight = 25–29.9 </li>
  <li>Obesity = BMI of 30 or greater</li>
  </ol>
  
  <p>If you are underweight or overweight or obese, determine the ideal weight based on your height and age.</p>
  
  <p>Estimate Ideal body weight in (kg) using Devine formula:</p>
  
  <p>Males: <code>IBW = 50 kg + 2.3 kg for each inch over 5 feet.</code></p>
  
  <p>Females: <code>IBW = 45.5 kg + 2.3 kg for each inch over 5 feet.</code> </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  double calculateBMI(double weight, double height);
  
  int main(void)
  {
      printf("Calculate your BMI\n"); //Calculation of body mass index (BMI)
  
      double w, h, ret;
      double BMI = w / (h*h);
      ret = calculateBMI(BMI);
  
      printf("Enter your weight in kilograms:\n", w); //Input your weight in kilograms here
      scanf("%lf", &amp;w);
      printf("Enter your height in metres:\n", h); //Input your height in metres here
      scanf("%lf", &amp;h);
      printf("Your BMI is %lf\n", ret)
  
      printf("BMI categories:\n");
      if (BMI &lt; 18.5)
      {
          printf("Your BMI is %lf and you are currently underweight.\n");
      }
      else if (BMI &gt;= 18.5 &amp;&amp; BMI &lt;= 24.9)
      {
          printf("Your BMI is %lf and you are normal weight.\n");
      }
      else if (BMI &gt;= 25 &amp;&amp; BMI &lt;= 29.9);
      {
          printf("Your BMI is %lf and you are currently overweight.\n");
      }
      else (BMI &gt;= 30);
      {
          printf("Your BMI is %lf and you are obese.\n");
      }
  
  
      return 0;
  }
  
  double calculateBMI(double weight, double height)
  {
      double result;
      result = weight / (height*height);
  
      return result;
  }
  </code></pre>
  
  <p>Help I still don't know how to do the functions. Please help me.</p>