You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
#include <stdio.h>
#include <math.h>
int main() {
int n;
printf("请输入一个1-100之间的整数:\n");
scanf("%d", &n);
int i = 0;
int q = sqrt(n);
for (i = 2; i <= q; i++ ) {
if(n % i == 0) {
break;
}
}
if (i > q) {
printf("%d是素数\n", n);
} else {
printf("%d不是素数\n", n);
}
return 0;
}