PRIME1 problem in SPOj. i get a SIGSEGV error y?pls help me out
- by R Karthikeyan
#include<stdio.h>
main()
{
long long int m,n,i,j;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lld",&m);
scanf("%lld",&n);
long long int a[n+2];
for(i=0;i<=n;i++)
{
a[i]=1;
}
for(i=2;i<=sqrt(n);i++)
{
j=2;
while((i*j)<=n)
{
a[i*j]=0;
j++;
}
}
for(i=m;i<=n;i++)
{
if(i==1)
continue;
if(a[i]!=0)
printf("%lld\n",i);
}
}
return 0;
}