#include<stdio.h>
#include<conio.h>
void main()
{
longint n,i,j,sum;
clrscr();
printf("\n");
for(i=1;i<=2000;i++)
{
sum=0;
for(j=1;j<i || j==1;j++)
if(i%j==0)
sum=sum+j;
if(i==sum)
{
for(j=1;j<i || j==1;j++)
if(i%j==0)
printf("%ld ,",j);
printf("\n THE SUM OF THIS FACTORS ARE %ld .\n",sum);
printf("SO %ld IS PERFECT NUMBER \n\n",i);
}
}
getch();
}
****************************** OUTPUT *********************************
1 ,
THE SUM OF THIS FACTORS ARE 1 .
SO 1 IS PERFECT NUMBER
1 ,2 ,3 ,
THE SUM OF THIS FACTORS ARE 6 .
SO 6 IS PERFECT NUMBER
1 ,2 ,4 ,7 ,14 ,
THE SUM OF THIS FACTORS ARE 28 .
SO 28 IS PERFECT NUMBER
1 ,2 ,4 ,8 ,16 ,31 ,62 ,124 ,248 ,
THE SUM OF THIS FACTORS ARE 496 .
SO 496 IS PERFECT NUMBER
************************************************************************