Dear all, my code get runtime at input 1500000, I run it locally and it showed "segmentation fault" but I have no idea about it. Can anyone help me? Thanks.

```
int countPrimes(int n) {
int count = 0;
int A[n];
int i,j,k,m;
for(m=0;m<=n;m++)
A[m] = 0;
for( i =2; i<=n;i++)
{
for( j=2; j<=n; j++)
{
if(i*j > n || A[i*j] == 1) break;
else
{
A[i*j] = 1;
}
}
}
for( k=2; k<=n; k++)
{
if(A[k] == 0)
{
count = count + 1;
}
}
return count;
```

}