title: scanf Getting Skipped
body: <p>I am trying to make a simple C program for a class and one of the requirements is that I'm required to use <code>scanf</code>/<code>printf</code> for all input and output. My question is why is it that my <code>scanf</code> after the for loop in the main gets skipped and the program just terminates.</p>
  
  <p>Here is my code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void main() {
      int userValue;
      int x;
      char c;
  
      printf("Enter a number : ");
      scanf("%d", &amp;userValue);
      printf("The odd prime values are:\n");
      for (x = 3; x &lt;= userValue; x = x + 2) {
          int a;
          a = isPrime(x);
          if (a = 1) { 
              printf("%d is an odd prime\n", x);
          }
      }   
      printf("hit anything to terminate...");
      scanf("%c", &amp;c);    
  }
  
  int isPrime(int number) {
      int i;
      for (i = 2; i &lt; number; i++) {
          if (number % i == 0 &amp;&amp; i != number)
              return 0;
      }
      return 1;
  }
  </code></pre>
  
  <p>I was able to "fix" it by adding another identical <code>scanf</code> after the first one, but I would prefer to just use the one.</p>