title: Counting number of integer inputs in C
body: <pre><code>int main()
  {
      int num[20];
  
      printf("Enter 4 integers: ");
  
      int n = scanf("%d %d %d %d",&amp;num[0],&amp;num[1],&amp;num[2],&amp;num[3]);
  
          if(n != 4)
          {
              printf("\n");
              printf("Input must consist of 4 integers\n");
              exit(0);
          } else if(n == 4)
          {
              if(sol_for_24(num))
              {
                  printf("\n");
                  printf("Yes! 24 is reachable from { %d, %d, %d, %d }\n", num[0], num[1], num[2], num[3]);
  
              } else {
                   printf("\n");
                   printf(sol_for_24(num) ? "\n" : "Noooo :( 24 is unreachable from { %d, %d, %d, %d }\n",num[0],num[1],num[2],num[3]);
              }
              }
  
      return 0;
  }
  </code></pre>
  
  <p>For the above main function code that I have written so far, what I want to achieve further is that, if I input more than or less than 4 times of digit numbers, it should print out something and exit the program. However, it does run the program even if I input more than 4 digit numbers(but executes only the first four front digit numbers). Can I please get any help or an advice of how I should fix this problem? I am really struggling on this problem.. Thanks.</p>