title: Accept Numerical Values only for input using scanf
body: <p>How can I make sure the user inputs numerical values only instead of alphanumeric or any other character? Also what to look for to insert error message for incorrent input? </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main()
  {
     int a, b, c;
  
  
     printf("Enter first number to add\n");
     scanf("%d",&amp;a);
  
     printf("Enter second number to add\n");
     scanf("%d",&amp;b);
  
     c = a + b;
  
     printf("Sum of entered numbers = %d\n",c);
  
     return 0;
  }
  </code></pre>