include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int main()
{
int N;
cin >> N;
for (int i = 0; i < N; i)
{
int x;
cin >> x;
int count = 0; // 每次循环开始时重置count变量
for (int j = 2; j <= sqrt(x); j) // 从2开始到sqrt(x)遍历找因数
{
if (x % j == 0)
{
count++;
break; // 一旦找到一个因数(除1和本身外)就可确定不是质数,直接退出内层循环
}
}
if (count == 0)
{
cout << x << ” is prime” << endl;
}
else
{
cout << x << ” is not prime” << endl;
}
}
return 0;
}