title: Why am I getting 'Floating point exception: 8'
body: <p>I'm trying to calculate all the prime numbers from 0 - 100 and I'm getting a floating point exception, could anyone tell me why? (If it helps I'm using gcc)</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
    int nums[100], i;
  
    for(i=0;i&lt;100;i++)
      nums[i] = i;
  
    int j,k,l,z;
  
    for(i=1;i&lt;100;i++)
      for(j=2;j&lt;100;j++)
        if((nums[i] % nums[j]) == 0)
         {
          nums[j] = 0;
         }
  
    for(i=0;i&lt;100;i++)
      if(nums[i] != 0)
        break;
  
    for(z=0;z&lt;100;z++)
      {  
        for(k=i;k&lt;100;k++)
         for(l = (k+2);l &lt; 100;l++)
           if((nums[k] % nums[l]) == 0)
             nums[k] = 0;
      }
  
    for(i=0;i&lt;100;i++)
      if(nums[i] != 0)
        printf("%d,",nums[i]);
  
    printf("\n");
  
    return 0;
  }
  </code></pre>