I'm trying since a day and my code is working both on ideone and gcc4.3.2 but not on SPOJ
This is my code
#include<iostream>
using namespace std;
void isprime(int n1, int n2){
int size = n2+1;
int primes[size];
for(int i=0;i<=n2;i++)
primes[i]=1;
primes[0]=primes[1]=0;
for(int i=2;i*i<=n2;i++){
if(primes[i] == 1)
for(int j=2;i*j<=n2;j++)
primes[i*j]=0;
}
for(int j=0;j<=n2;j++)
if(primes[j]==1 && (j>=n1 && j<=n2))
cout<<j<<endl;
}
int main(){
int t,n1,n2;
cin>>t;
for(int i=1;i<=t;i++){
cin>>n1>>n2;
isprime(n1,n2);
cout<<endl;
}
}