#include "stdio.h"
void main()
{
int j,k,sum = 0;
for(k=2;k<=1000;k++)
{
sum=0;
for(j=1;jif(k%j==0)
sum=sum+j;
if(sum==k)
printf("%d ",k);
}
}
#include
int ws(int a)
{
int i=1;
int sum=0;
while(i{
if(a%i==0)
sum+=i;
i++;
}
if(sum==a)
return 1;
else return 0;
}
void main()
{
int n=2,i,j,k=0,a[100],shu=0;
printf("%d以内的完数有:",1000);
while(n<=1000)
{
if(ws(n))
{
for(i=1;i
a[k++]=i;
printf("\n%d=%d",n,a[0]);
for(j=1;j
shu++;
k=0;
}
n++;
}
printf("\n");
}