#include <stdio.h>
int main() {
int num = 17;
int isPrime = 1;
for (int i = 2; i <= num / 2; i++) {
if (num % i == 0) {
isPrime = 0;
break;
}
}
if (isPrime == 1) {
printf("%d is prime\n", num);
} else {
printf("%d is not prime\n", num);
}
return 0;
}
标签:prime,判断,int,是否,质数,num,printf,isPrime From: https://blog.51cto.com/u_16284467/8238949