#include<stdio.h>
#define ARSIZE 1000000
int main()
{
int i=0,j=0,c=0,k,n;
int prep[ARSIZE];
for(i=0;i<1000000;i++)
{
j++;
for(k=2;k<j;k++)
{
if(j%k==0)
c++;
}
if(c==2)
prep[i]=j;
c=0;
}
printf("Enter N : ");
scanf("%d\n",&n);
printf("%d",prep[n-1]);
getch();
return 0;
}
why is this code giving segmentation fault??