请大神给解释一下程序中的语句if(isPrime)什么意思,有什么作用?
#include<stdio.h>int main(void)
{
unsigned long num;
unsigned long div;
int isPrime;
printf("Please enter an integer for analysis;");
printf("Enter q to quit.\n");
while(scanf_s("%lu",&num)==1)
{
for(div=2,isPrime=1;(div*div)<=num;div++)
{
if(num%div==0)
{
if((div*div)!=num)
printf("%lu is divisible by %lu and %lu.\n",num,div,num/div);
else
printf("%lu is divisible by %lu.\n",num,div);
isPrime=0;
}
}
if(isPrime)//这个语句是什么意思,有什么作用?
printf("%lu is prime.\n",num);
printf("Please enter an integer for analysis;");
printf("Enter q to quit.\n");
}
printf("Bye bye!\n");
getchar();
return 0;
}