getting time limit exceeded for the problem PRIME1 .what should i do
#include<iostream>
#include<stdio.h>
int main()
{
int x,t;
unsigned long a,b,i,j;
scanf("%ul",&t);
while(t--)
{
scanf("%u",&a);
scanf("%u",&b);
for(i=(a==1?2:a);i<=b;i++)
{
x=0;
for(j=2;j<i;j++)
if(i%j==0)
{
x++;
break;
}
if(x==0)
printf("%u\n",i);
}
}
}