title: C Programming: How to check if user has entered numeric values only in the following expression?
body: <p>I am taking a certain date as an input from user in following format: mm/dd/yyyy.</p>
  
  <p>How can I make certain that the user is entering numeric values only and if not then prompt him again to enter a valid date. I am already checking if a date is valid or not on basis of the values entered but if the values entered by user are not entirely numeric then the program crashes.</p>
  
  <p>Please help...</p>
  
  <p>The Code:</p>
  
  <pre><code>int x=0;
  printf("\nEnter the date of birth(mm/dd/yyyy):");
  do
  {
      scanf("%d/%d/%d",&amp;add.dob.month,&amp;add.dob.day,&amp;add.dob.year);
      if((add.dob.month&lt;13 &amp;&amp; add.dob.month&gt;0) &amp;&amp; (add.dob.day&gt;0 &amp;&amp; add.dob.day&lt;32) &amp;&amp; (add.dob.year&lt;2016))
      {
          x=1;
      }
      else
      {
          printf("\nThe above date of birth is invalid.\nEnter a valid date of birth(mm/dd/yyyy):");
      }
  }while(x!=1);
  </code></pre>