#include
int main()
{
int i,j,sum=0;
int count=0;//计算完数的和
for(i=2;i<1000;i++)
{
for(j=1;j {
if(i%j==0) sum=sum+j;
}
if(sum==i)
{
printf("%d 是完数\n",i);
count+=i;
}
sum=0;
}
printf("完数和为: %d\n",count);
return 0;
}
#include
#include
#define N 1000
void main()
{
int num,f[20],i,j,sum,t;
unsigned short flag;
/*Out Recycle*/
for(num = 2;num
sum=0;
j= 0;
/*Inner Recycle*/
for(i=1;i<=num/2;i++)
{
if(num%i==0)
{
f[j]=i;
sum+=f[j];
j++;
}
}
/*justify it is a perfect num*/
t=j-1;
if(sum==num)
{
printf("%d its factors are",num);
for(j=0;j<=t;j++)
printf("%d,",f[j]);
printf("\n");
}
/* enter next column*/
}
system("pause");
}