title: C: My loop doesn't seem to work
body: <p>Im new to C, and today I encountered a problem I haven't managed to figure out, so I need some help. We've been given this task:</p>
  
  <p><em>'Write a program that demonstrates a ‘while’ loop that uses the ‘read-ahead’ technique: it asks the user to enter numbers between (and including) 10 and 100, entering a zero terminates the loop. If numbers less than 10 or larger than 100 are entered an error message is shown (e.g. “Error: 250 is not allowed”). After termination of the loop the program prints the amount of numbers that was entered.'</em></p>
  
  <p>The issue I have is that once I type in a valid number (between 10-100) the program sits still, it doesn't terminate nor loop. On the other hand, if I type in a non valid number like 8, 102 it loops the printf("Error, %d is not allowed\n", num);</p>
  
  <p>here's the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  
  main(void)
  
  {
  
  int num;
  int counter=1;
  
  printf("Please type in your number between (and including) 10-100\n");
  scanf("%d", &amp;num);
  
  if((num &lt;10) || (num &gt;100))
  {
      printf("Error, %d is not allowed\n", num);
  }
  
  while (num &gt; 0)
  {
      counter++;
  
      if((num &lt;10) || (num &gt;100))
      {
          printf("Error, %d is not allowed\n", num);
      }
      counter++;
  }
  
  
  printf("%d numbers were entered!\n", counter);
  
  }
  </code></pre>