#include<stdio.h>
#include<math.h>
int main(){
int n,m,count=0;
scanf("%d",&n);
while(n--){
scanf("%d",&m);
for(int t = 2;t<sqrt(m);t++){
if(m % t == 0){
count++;
}
else{
continue;
}
}
if(count == 0 && m > 1){ //注意素数是大于1的数,因此要在这里加上这个条件,否则得不到满分
printf("yes\n");
}
else{
printf("no\n");
}
count = 0;
}
return 0;
}
C语言判断素数
最新推荐文章于 2023-04-02 16:17:28 发布