题目描述
质数
样例
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int n;
cin >> n;
while (n--)
{
int p;
cin >> p;
bool is_prime = true;
for(int i=2;i*i<=p;i++)
if(p%i==0)
{
is_prime = false;
break;
}
if(is_prime) printf("%d is prime\n",p);
else printf("%d is not prime\n",p);
}
return 0;
}