#include<stdio.h>
int main()
{
int n,i;
printf("please enter a integer number,n=?");
scanf("%d",&n);
for (i=2;i<=n-1;i++)
if(n%i==0) break;
if(i<n) printf("%d is not a prime number.\n",n);
else printf("%d is a prime number,\n",n);
return 0;
}
C程序设计 例题5.9 判断一个大于3的数是否为素数
最新推荐文章于 2022-07-20 11:17:40 发布