#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
main()
{
int i, j, s, n;
printf("输入所范围的上限:");
scanf("%d", &n);
for (j = 2; j <= n; j++)
{
s = 1; //保证每次循环i的初值为1
for (i = 2; i <= j / 2; i++)
if (j % i == 0) //判断i是否为j的因子
s += i;
if (s == j)printf("This is a perfect number:%d\n", j);
}
}
标签:SECURE,CRT,WARNINGS,int,完数,main
From: https://www.cnblogs.com/258-333/p/17421680.html