title: Trouble figuring out logic for while/if loop in C
body: <p>I have a some code, and the function I am having trouble with is this: </p>
  
  <pre><code>unsigned int getInputData() {
  
      printf("Please input a positive integer number terminated with a carriage return.\n");
  
      do{ 
          scanf("%c", &amp;input);
  
          if(isdigit(input))  {
              temp = charToInt(input);
              rValue = mergeInt(rValue, temp);
          }
          if(rValue &gt;= imax)  {
              rValue = 0;
              printf("ERROR: That is too large of an integer. Please try again. \n");
          }
          else if(isalpha(input)){
              rValue = 0;
              printf("This is not a integer. Please try again. \n");
          }
          else{
              printf("OK. This is a good number. \n");
          }
      } while(1);
  }
  </code></pre>
  
  <p>I'm scanning in each <code>char</code> individually, merging it into an <code>int</code>. Which is exactly what I want to do BUT I only want it to print <code>"OK. This is a good number."</code> once when the user types it in. Example: If someone was to type in: <code>12345</code> I want it to return: <code>"OK. This is a good number."</code> once for those 5 char rather than once each. Hoping this makes sense, been at it for awhile so anything will help. </p>