Răspuns:
#include <iostream>
using namespace std;
int main()
{
unsigned int n,i,j,nr=0,X=0;
cout<<"n=";
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
cout<<"a["<<i<<"]=";
cin>>a[i];
}
for(i=0;i<n;i++)
{
for(j=2;j<=a[i]/2;j++)
{
if(a[i]%j==0)
X++;
}
if(X==0)
nr++;
else
X=0;
}
cout<<nr;
return 0;
}
Explicație: