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,i,flag=1;
|
|
scanf("%d",&n);
|
|
for(int i=2;i<=sqrt(n);i++)
|
|
{
|
|
if(n%i==0)
|
|
{
|
|
flag=0;
|
|
printf("%d不是素数\n",n);
|
|
break;
|
|
}
|
|
if(flag==1)
|
|
{
|
|
printf("%d是素数\n",n);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|