title: Output is incorrect and cannot find error in code. kochans book on C
body: <p>I am working to learn C with Stephen Kochans book Programming in C.  I am having an issue with the program on page 82.  The program takes a mathmatical expression and solves it.  My problem is with the final else statement, which is intended to notify the user if they input an invalid character.  When I run the program, I receive a long number, not the statement "Uknown operator" that I have programmed.</p>
  
  <p>I am working in Codeblocks.  Ive checked the program a few times against the book (its written letter for letter).  Any input would be great.  Right now i suspect something with the compiler that I am overlooking or unaware of.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  int main(void)
  
  {
  float value1, value2;
  char operato;
  
  printf ("Type in your expression.\n");
  scanf ("%f %c %f", &amp;value1, &amp;operato, &amp;value2);
  
  if (operato == '+')
      printf ("%.2f\n", value1 + value2);
  else if (operato == '-')
      printf ("%.2f\n", value1 - value2);
  else if (operato == '*' )
      printf ("%.2f\n", value1 * value2);
  else if (operato == '/' )
      if (value2 == 0)
          printf ("Division by zero.\n");
      else
          printf ("%.2f\n", value1 / value2);
  else
      printf ("Unknown operator.\n");
  return 0;
  }
  </code></pre>