Prime visits output issue1

#include
using namespace std;

int main()
{
int t;
cin>>t;
while(t–)
{
int a,b,count=0;
cin>>a>>b;
for(int i=a;i<=b;i++)
{
bool flag=true;
if(i==1)
flag=false;
for(int j=2;j<=i/2;j++)
{
if(i%j==0)
{
flag=false;
break;
}
}
if(flag)
count++;
}
cout<<count<<endl;
}
return 0;
}

what am i doing wrong

@16102097yash hey yash this approach will not work with this question .this question is implemented using sieve of erthathones.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.