程序:运用函数找出100至200的素数,并数出个数

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6


#include<stdio.h>
int if_a_is_prime(int d)
{
int c = 2;
for (c = 2; c<d ; c++)
{
if ( d%c == 0)
{
return 0;
}
}
return 1;

}

int main()
{
int a = 100;
int b = 0;
int count = 0;
for (a = 100; a <= 200; a++)
{

if ( if_a_is_prime(a)== 1)
{
printf("%d ", a);
count++;
}

}

printf("\n总共有%d个素数", count);
return 0;
}


程序:运用函数找出100至200的素数,并数出个数_c++

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6