title: Skipping lines of code in C i/o
body: <p>When learning C in simple programs it often happens that the computer skips the execution of some lines of code, and I can't understand why this is so.</p>
  
  <p>Now as an example, I sketched a program which simply stores 3 numbers entered by the user:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
  int a, b, c;
  
  printf("Please type in number a: \n");
  scanf("%i", &amp;a);
  printf("Please type in number c: \n");
  scanf("%i", &amp;c);
  printf("Please type in number b: \n");
  scanf("%i", &amp;b);    
  return 0;
  }
  </code></pre>
  
  <p>I want to enter 1, 2, and 3. This is what I get in the console (in Ubuntu):</p>
  
  <pre><code>Please type in number a:
  1
  Please type in number b:
  Please type in number c:
  2
  </code></pre>
  
  <p>The input of number b was ignored.</p>
  
  <p>Not only the second input is skipped, so even the input is in the wrong order. Initially, I wrote everything in alphabetic order in the code - a, b and c, then the input of b was skipped, and then I changed the order in the code and still, as you can see, the execution remained unchanged.</p>
  
  <p>And such cases I have had earlier.</p>
  
  <p>Why is this happening?</p>