title: Floating point exception
body: <p>I successfully  complied this code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  int q;
  
  int main()
  {
      srand( time(NULL) );
      int n=3;
      q=ceil(sqrt(n));
      printf("%d\n %d\n", n,q);
  
      if(n == 2)
          printf("%d\n is prime", n);
      else if(n % 2 == 0.0 || n &lt; 2)
          printf("%d\n is not prime", n);
      else
      {
          int x;
          for(x = 0; x &lt; q; x++){
              if(n % x == 0)
              {
                  printf("%d\n is not prime", n);
                  return;
              }
              else
                  printf("%d\n is prime", n);
          }
      }
  }
  </code></pre>
  
  <p>But when I run my code I get the following error:</p>
  
  <blockquote>
    <p>Floating point exception</p>
  </blockquote>
  
  <p>What does this error mean and how can I fix it?</p>