题解 | #完全数计算#
完全数计算
http://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
include <stdio.h>
int main()
{
int i,j,k=0,n;
while(scanf("%d",&n)!=EOF)
{
int num=0;
for(j=2;j<=n;j++)
{
k=0;
for(i=1;i<j;i++)
{
if(j%i==0)
{
k=k+i;
}
}
if(k==j)
{
num=num+1;
}
}
printf("%d\n",num);
}
return 0;
}