title: C programming - Loop until user inputs number scanf
body: <p>I need help with error checking for my program. I'm asking the user to input a integer and I would like to check if the users input is a integer. If not, repeat the scanf.</p>
  
  <p>My code:</p>
  
  <pre><code>int main(void){
  
    int number1, number2;
    int sum;
  
    //asks user for integers to add
    printf("Please enter the first integer to add.");
    scanf("%d",&amp;number1);
  
    printf("Please enter the second integer to add.");
    scanf("%d",&amp;number2);
    //adds integers
    sum = number1 + number2;
  
    //prints sum
    printf("Sum of %d and %d = %d \n",number1, number2, sum);
  
    //checks if sum is divisable by 3
    if(sum%3 == 0){
      printf("The sum of these two integers is a multiple of 3!\n");
    }else {
      printf("The sum of these two integers is not a multiple of 3...\n");
    }
    return 0;
  }
  </code></pre>