Linux/Code/xunhuan3.c
2025-05-12 15:12:59 +08:00

27 lines
457 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
int main()
{
int n,i,j;
for(j=0;j<5;j++)
{
printf("请输入第%d个数\n",j+1);
scanf("%d",&n);
if(n<2)
{
printf("%d不是素数\n",n);
continue;
}
for(i=2;i<n;i++)
if(n%i==0)
break;
if(i<n)
printf("%d不是素数\n",n);
else
printf("%d是素数\n",n);
}
return 0;
}