#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<Windows.h>
#include<stdio.h>
#define N 10
void judgesushu(int n1)
{
int count = 1;
for (int i = 2; i < n1; i++)
{
if (n1%i == 0)
{
count = 0;
printf("%d不是素数\n", n1);
break;
}
}
if (count==1) printf("%d是素数\n",n1);
}
void main()
{
int n = N;
judgesushu(n);
system("pause");
}
编写一函数判断某数是否是素数
最新推荐文章于 2023-11-15 20:02:41 发布