Array modi prime visit question

array modi prime visits
//prime visits
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n>0)
{
int a,b;
int count=0;
cin>>a>>b;
for(int i=a;i<=b;i++)
{ if(i==2)
{
count++;
}
for(int j=2;j<i;j++)
{
if(i%j==0)
{
break;
}
if(i%j!=0 && j==i-1)
{
count++;
}
}

    }
    cout<<count<<endl;
n--;
}
return 0;

}

check one test case doent pass

hey @Priyanshu-Goel-1161416680732439, please share the code saved in Coding blocks ide.
If its is giving TLE then use prime seive approach to calculate prime numbers.