#include
#include<math.h>
using namespace std;
bool prime(long long unsigned int n){
if(n==2)return true;
if(n==1 || n%2==0)return false;
for(long long unsigned int i=3;i<=sqrt(n);i+=2){
if(n%i==0)return false;
}
return true;
}
int main()
{
long long unsigned int T,m;
cin>>T;
while(T–){
cin>>m;
if(prime(m))cout<<"YES"<<"\n";
else cout<<"NO";
}
return 0;
}
Whats wrong in my code , I checked until sqrt(n) but still getting TLE error