Perfect Numbers

This code will not produce any output.
It should find all the perfect numbers between 1 and 1000.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  #include<iostream>
using namespace std;
int main()
{
    int num = 1, adder = 1, numChecker = 0;
    for(num = 1; num >= 1000; num++)
    {
    numChecker = 0;
    for(adder = 1; adder > num; adder++)
    {
    if(num % adder == 0)
    numChecker += adder;

    }
        if(num == numChecker)
    cout << num << endl;
    }
    return 0;
}


the out put just says finished with exit code 0.
Last edited on
Swap the > for < on lines 6 and 9.
Topic archived. No new replies allowed.