一、N-S流程图;
二、运行结果;
三、源代码;
cs
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
int main()
{
//初始化变量值;
int n = 0;
int i = 1;
int j = 0;
int result = 1;
//提示用户;
printf("请输入一个数:");
//获取用户输入数据;
scanf("%d", &n);
//输出结果;
printf("%d its factor are %d", n, i);
//运算;
for (i = 2; i < n; i++)
{
//判断;
if (n % i == 0)
{
//运算;
result = result + i;
//输出;
printf(" %d", i);
}
}
//换行;
printf("\n");
//判断;
if (n == result)
{
//输出结果;
printf("%d是完数!!!!\n", n);
}
else
{
//输出结果;
printf("%d不是完数!!!!\n", n);
}
return 0;
}