title: When I input any char inside int it makes it equal 8
body: <p>im facing a problem in part of my code, where i have switch(num) and have cases for numbers from 6 to 14 and default . whenever the input is not an integer the switch statement reads it as 8 and not as default and when i removed 8 it went back to default !</p>
  
  <p>any ideas why is this happening ? </p>
  
  <p>Thank you in advance </p>
  
  <p>example of my problem </p>
  
  <pre><code>scanf("%d",&amp;num);
  switch(num) 
  { case 6 : loop6 ; break; 
  case 7 :  loop7 ; break;
  case 8 :  loop8 ; break ; 
  default : printf("unknow value "); break ; } 
  </code></pre>
  
  <p>input : not an integer 
  output : enters loop8 and doesnt print unknow value .</p>