一、运行结果;
二、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
//实现素数判断函数;
int Prime(int number)
{
//初始化变量值;
int divided = 2;
int JudgementCondition = 0;
//循环判断素数;
while (divided < number && JudgementCondition == 0)
{
//运算判断;
if (number % divided)
{
//改变变量值;
divided++;
}
else
{
//改变判断数据的值;
JudgementCondition = 1;
}
}
//判断结果;
if (JudgementCondition == 0)
{
//打印结果;
printf("%d 是素数!!!\n", number);
}
else
{
//打印结果;
printf("%d 不是素数!!!\n", number);
}
}
int main()
{
//初始化变量值;
int number = 100;
//循环调用素数判断函数;
while (number <= 200)
{
//调用素数判断函数;
Prime(number);
//改变变量值;
number++;
}
return 0;
}
三、流程图;
四、N-S流程图;