写一个判别素数的函数,在主函数中输入一个整数,输出是否为素数的信息。

#include <stdio.h>
int sushu(int m)
{
int i,n=0;
for(i=2;i<m;i++)
{
if (m%i==0)
n++;
}
return n;
}

void main()
{
int sushu(int m);
int m;
printf (“Please enter a number\n”);
scanf ("%d",&m);
if (sushu(m)==0)
printf("%dshisushu\n",m);
else
printf("%dbushisushu\n",m);
}

写一个判别素数的函数,在主函数中输入一个整数,输出是否为素数的信息。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
相关资源
相似解决方案