TLE in Prime visits

Need help with Prime visits (TLE case #3)
#include
#include<math.h>
using namespace std;
int main() {
int n;
cin>>n;
while(n–){
int a,b,c=0;
cin>>a>>b;
if(a<2)a=2;
for(int i=a;i<=b;i++){
int temp=0;
int k=sqrt(i)+1;
for(int j=2;j<=k&&j<i;j++)
if(!(i%j)){temp=1;break;}
if(!temp)c++;
}
cout<<c<<endl;
}
}

hey @Equinoxx9, Please share your code here saved in IDE coding blocks.

#include
#include<math.h>
using namespace std;
int main() {
int n;
cin>>n;
while(n–){
int a,b,c=0;
cin>>a>>b;
if(a<2)a=2;
for(int i=a;i<=b;i++){
int temp=0;
int k=sqrt(i)+1;
for(int j=2;j<=k&&j<i;j++)
if(!(i%j)){temp=1;break;}
if(!temp)c++;
}
cout<<c<<endl;
}
}

Hey @Equinoxx9, first of all sorry for this late reply. Check constraint for your code they are of small range, given question has high constraints. Replace these int to long long int

hey @Equinoxx9,if no further query,please mark this doubt as resolved.