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.
Htu/函数判断素数.c

40 lines
377 B

#include<stdio.h>
#include<math.h>
int judge(int m)
{
int i,count=0;
if(m<2)
{
return 0;
}
for(i=2;i<=sqrt(m);i++)
{
if(m%i==0)
{
count++;
}
}
if(count==0)
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int n;
scanf("%d",&n);
if(judge(n)==1)
{
printf("Yes");
}
else
{
printf("No");
}
return 0;
}