title: How to check whether the entered symbol is char or not?
body: <p>I have a problem with calculator. I want to program a calculator, but it "works" with letters too. If I enter f.e letters "s" and "u", i get answer 0. How to repair that?  </p>
  
  <pre><code># include &lt;stdio.h&gt;
  
  int main() {
  
  char operator;
  int a,b;
  
  printf("Enter the operator (+, -, *, /): ");
  scanf("%c", &amp;operator);
  
  printf("Enter two number and seperate them with space: ");
  scanf("%lf %lf",&amp;a, &amp;b);
  
  switch(operator)
  {
      case '+':
          printf("%.2lf + %.2lf = %.2lf",a, b, a + b);
          break;
  
      case '-':
          printf("% 2lf - %.2lf = % 2lf",a, b, a - b);
          break;
  
      case '*':
          printf("%.2lf * %.2lf = %.2lf",a, b, a * b);
          break;
  
      case '/':
          printf("%.2lf / %.2lf = %.2lf",a, b, a / b);
          break;
  
  
      default:
          printf("Error!");
  
  }
  
  return 0;
  }
  </code></pre>
  
  <p>Sorry, if the question has been up here.<br>
  The link to answer is also appreciated!<br>
  Cheers!</p>