title: How to use isdigit() for a pin while loop
body: <p>This program accepts any four digit number as the pin , so i used a <code>strlen()</code> to find out whether the pin is has four characters, but I need to make sure that user enters four numbers, how do I use <code>isdigit()</code> before the loop and for the loop condition?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  char pin [4];
  
  printf("Please enter your pin :    \n") ;
  scanf("%4s" , &amp;pin) ;
  system("cls") ;
  
  while (strlen(pin) != 4) {
      count = count + 1 ;
      if(count &lt; 3){
          printf("Invalid Pin \n") ;
          printf("Please enter your pin again \n") ;
          scanf("%4s", &amp;pin) ;
          system("cls");
      }
      else if (count == 3){
          printf("Sorry you can't continue , Please contact your bank for assistance !") ;
          return 0 ;
      }
  }
  </code></pre>