title: Infinite loop code in C
body: <p>In the below program I try to input a number between <code>1</code> to <code>100</code> but if I enter <code>a</code> <code>'character'</code> or <code>"string"</code> ( like s or <code>sova</code> ) during the execution time of <code>scanf()</code> statement it creates a infinite loop. so I try to do .... when I input a string or a character it shown me a message like "wrong value entered. enter again" and it will enter again...<br>
  Thanx;</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      int a;
      scanf("%d",&amp;a);
      while(!(a&gt;=1&amp;&amp;a&lt;=100))
      {
          printf("wrong value entered. enter again\n");
          scanf("%d",&amp;a);
      }
      printf("you enter %d. Thanxz",a);
      return 0;
  }
  </code></pre>