Discussion About Primality Testing

This is Discussion thread about Primality Testing

im not able to submit my code for primary testing …

long m,n,a[1000];
std::cin>>n;
for(int m=0;m<n;m++)
std::cin>>a[m];
for( m=0;m<n;m++)
{int c=0;
for(int i=1;i<=a[m];i++)
{if(a[m]%i==0)
c++;}
if(c==2)
std::cout<<“YES\n”;
else std::cout<<“NO\n”;}
this is my code …please help