title: C programming calculator using switch statement and calling function
body: <p>Everything complies alright but I'm just wondering why its not reading the switch statement and enter the operator it. </p>
  
  <p>EX: Enter first number 5 then it automatically reads the default statement enter      second number 2 and the result is 0.</p>
  
  <pre><code>float addNum(float, float);
  float subtractNum(float, float);
  float multiplyNum(float, float);
  float divideNum(float, float);
  
  #include &lt;stdio.h&gt;
  #include &lt;ctype.h&gt;
  
  int main()
  {
      char opNum;
      float result;
      float firstNum;
      float secNum;
  
      printf("Enter first number: ");
      scanf("%f", &amp;firstNum);
      printf("Enter the operator:\n");
      scanf("%c", &amp;opNum);
      switch (opNum)
      {
          case '+':
              result = addNum(firstNum, secNum);
              break;
  
          case '-':
              result = subtractNum(firstNum, secNum);
              break;
  
          case '*':
              result = multiplyNum(firstNum, secNum);
              break;
  
          case '/':
              result = divideNum(firstNum, secNum);
              break;
  
          default:
              printf("The operator you entered is invalid.");
      }
      printf("Enter second number: ");
      scanf("%f", &amp;secNum);
      printf("Your total number is: %f", result);
      return 0;
  }
  
  float addNum(float firstNum, float secNum)
  {
      float result = 0.0;
      result = firstNum + secNum;
      return result;
  }
  
  float subtractNum(float firstNum, float secNum)
  {
      float result = 0.0;
      result = firstNum - secNum;
      return result;
  }
  
  float multiplyNum(float firstNum, float secNum)
  {
      float result = 0.0;
      result = firstNum * secNum;
      return result;
  }
  
  float divideNum(float firstNum, float secNum)
  {
      float result = 0.0;
      result = firstNum / secNum;
      return result;
  }
  </code></pre>