#include
void getPerfectNumber(int n){
int k[100],kc = 0,ks=0;
for (int i=1;i<=n;i++){
for (int j=1;j<=i/2;j++){
if (i%j == 0)
k[kc++] = j;
}
for (int j=0;jks += k[j];
k[j] = 0;
}
if (ks == i)
printf("%d\n", i);
kc = 0;
ks = 0;
}
}
int main ()
{
getPerfectNumber(1000);
return 0;
}