#include <stdio.h>
int main (){
int i,a,b,d,n,sum;
printf("请输入一个整数:");
scanf("%d",&a) ;
for(i=1;i<=a;i++)
{
sum=0;
for(n=1;n<i;n++)
{
b=i%n;
if(b==0)
sum=n+sum;
}
if(sum==i)
{ d++;
printf(" 第%d个完美数是%d\n",d,sum );
printf(" its factors are " );
for(n=1;n<i;n++)
if(i%n==0)
printf(" %d ",n);
printf("\n");
}
}
return 0;
}