#include<iostream.h>
#include<conio.h>
using namespace std;
int main()
{
char tanya;
int bilangan,jumlah,i,sum,x;
system(“cls”);
cout<<” | ================================ |”<<endl;
cout<<” | Program Perfect Number [ 1..1000 ] |”<<endl;
cout<<” |================================ |”<<endl<<endl;
cout<<endl;
cout<<“ Perfect Number [1..1000] adalah : ” ;
cout<<endl;
for(int i = 1; i < 1000; i++)
{
sum = 0;
for(int j = 1; j < i; j++)
{
if(i % j == 0) sum += j;
}
if(sum == i)
{
cout<<endl;
cout << ” ” << i << ” = ” ;
for (x=1;x<=sum-1;x++)
{
jumlah = sum%x;
if (jumlah==0)
{
if (x < sum/2)
cout<<x <<” + ” ;
else
cout<<“” <<x;
}
}
}
}
cout<<endl;
cout<<endl;
system(“pause”);
return 0 ;
}