#include<stdio.h>

#include<math.h>

int isprime(unsigned long x)

{

int i,c=0;

if(x==1)

return 0;

else if(x==2 || x==3)

return 1;

else if(x%2==0)

return 0;

else if(x%3==0)

return 0;

else

{

for(i=5;(i<=sqrt(x))&&((i%3)!=0);i+=2)

{

if(x%i==0)

c++;

}

if(c==0)

return 1;

else

return 0;

}

}

```
int main()
{
int t,i,j;
unsigned long a,b;
scanf("%d",&t);
while(t--)
{
scanf("%lu%lu",&a,&b);
for(i=a;i<=b;i++)
{
if(isprime(i)==1)
printf("%lu\n",i);
}
printf("\n");
}
return 0;
}
```