title: Problem with BMI calculation program - if else and calculation errors in dev C++
body: <p>For some reason, it doesn't let me insert the weight data, prints only the ''short man'' category (regardless of height data inserted), doesn't print BMI'S value and completely ignores the last ''if else'' statement. I can't seem to find the problem as it looks perfectly fine to me. I'm using dev c++.</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void) {
      char gender;
      float height;
      float weight;
      int category;
      float BMI;
      
      printf(&quot; Enter gender: &quot;);
      scanf(&quot;%c&quot;, &amp;gender);
      printf(&quot; Enter height: &quot;);
      scanf(&quot; %.2f&quot;, &amp;height);
      printf(&quot; Enter weight: \n&quot;);
      scanf(&quot; %.1f&quot;, &amp;weight);
             
      
      if ((gender == 'M'|| gender == 'm') &amp;&amp; (height &lt; 1.70 ))
      {
              category = 1;
              printf(&quot;Short man\n&quot;);
       }
      else if ((gender == 'M'|| gender == 'm') &amp;&amp; (height &gt;= 1.70 &amp;&amp; height&lt; 1.85))
           {
               category = 2;
               printf(&quot;Average man\n&quot;);
           }
      else if ((gender == 'M'|| gender == 'm') &amp;&amp; (height &gt;= 1.85))
           {
              category = 3;
              printf(&quot;Tall man\n&quot;);
           }
       
       else if (( gender == 'F' || gender == 'f' ) &amp;&amp; (height &lt; 1.60))
       {
                category = 4;
                printf(&quot;Short woman\n&quot;);
            }
      else if (( gender == 'F' || gender == 'f' ) &amp;&amp; (height &gt;= 1.60 &amp;&amp; height &lt;1.75))
            {
                category = 5;
                printf(&quot;Average woman\n&quot;);
            }
      else if (( gender == 'F' || gender == 'f' ) &amp;&amp; (height &gt;= 1.70))
            { 
              category = 6;
              printf(&quot;Tall woman\n&quot;);
            }
      
       
       switch(category)
       {
          case 1:
          {
             printf(&quot;Belongs to first category &quot;);
           }
          break;
           
           
          case 2:
          {
              printf(&quot;Belongs to second category &quot;);
          }
          break;
          
          case 3:
          {
               printf(&quot;Belongs to third category &quot;);
          }
          break;
          
          case 4:
          {
              printf(&quot;Belongs to fourth category &quot;);
          }
          break;
          
          case 5:
          {
              printf(&quot;Belongs to fifth category &quot;);
          }
          break;
          
          case 6:
          { 
               printf(&quot;Belongs to sixth category &quot;);
          }
          break;
       }
       
       BMI = (weight / (height * height));
       printf(&quot; BMI is:, %.1f \n&quot;, BMI);
       
       if ( BMI &lt;= 18.5)
       {
          printf(&quot;Underweight\n&quot;);
       }
       else if (BMI &gt; 18.5 &amp;&amp; BMI&lt;= 25)
       {
          printf(&quot;Normal\n&quot;);
       }
       else if (BMI &gt; 25 &amp;&amp; BMI &lt;=30)
       {
          printf(&quot;Overweight\n&quot;);
       }
       else if (BMI &gt; 30)
       {
          printf(&quot;Obese\n&quot;);
       }
       
       
      return 0;
  } 
  </code></pre>