Prime Visits Output issue

#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=false;
if(i==1)
flag=true;
for(int j=2;j<=i/2;j++)
{
if(i%j==0)
{
flag=true;
break;
}
}
if(!flag)
count++;
}
cout<<count<<endl;
}
return 0;
}
please let me know what Im doing wrong!

@16102097yash hey yash you create your doubt with wrong title this code related to prime numbers and prime visits is implemented using sieve of erthothanes.