title: Problems with a Do-While Loop in C
body: <p>I extremely new at coding and I'm tearing my hair out trying to get this code to loop (until the correct criteria has been met.. upper/lower case letters and a digit) am I putting the do while loop in the right place??</p>
  
  <p>Many Thanks in advance for any help received..</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  #include &lt;math.h&gt;
  #include &lt;stdlib.h&gt;
  
  main()
  {
      int i;
      int hasUpper, hasLower, hasDigit;
      char password[20];
  
      hasUpper = hasLower = hasDigit = 0; // initialising these three variables to false (o)
  
      printf("Please enter a alpha numeric password with upper and lower case\n");
      scanf(" %s", password);
  
      do {
          for (i = 0; i &lt; strlen(password); i++) {
              if (isdigit(password[i])) {
                  hasDigit = 1;
                  continue;
              }
  
              if (isupper(password[i])) {
                  hasUpper = 1;
                  continue;
              }
  
              if (islower(password[i])) {
                  hasLower = 1;
                  continue;
              }
          }
  
          printf("Not so good, try again!");
          scanf(" %s", password);
      } while ((hasDigit) &amp;&amp; (hasLower) &amp;&amp; (hasUpper)==1);
  
      // This loop will only execute if all three variables are true
  
      if ((hasUpper) &amp;&amp; (hasLower) &amp;&amp; (hasDigit)) {
          printf("Great password!");
      }
  
      return 0;
  }
  </code></pre>