#include <stdio.h> int main(void) { int n, i, s; for (n = 1; n <= 1000; n++) { s = 0; for (i = 1; i <= n/2; i++) if (n % i == 0) s += i; if (n == s) printf("%d\n", n); } return 0; }