1 / 2
May 2010

I got answer in my lap but it s not working in spoj can u tell me y

include

void pp(long int r,long int s)
{
int f=0;
long int i,j;
for(j=r;j<=s;j++)
{

for(i=2;i{
if((j%i)==0)
f=1;
}

if(f==0)
printf("\n%ld",j);
f=0;
}
}
int main()
{
long int m,n;
int t,i,u;
scanf("%d",&t);
for(i=0;i{
scanf("%ld %ld",&n[i],&m[i]);
printf("\n");

}
for(i=0;i{
pp(n[i],m[i]);
printf("\n");
}
scanf("%d",&u);
return(0);
}

  • created

    May '10
  • last reply

    May '10
  • 1

    reply

  • 93

    views

  • 2

    users

Welcome to the forum. I suggest that you read the post by TripleM that is stickied in the ProblemSet Archive forum.

More information than "it doesn't work" is needed. Wrong Answer (WA)? Time Limit Exceeded(TLE)?

You're definitely going to get a TLE, test using a maximum sized input and you'll see why.