请问我这段代码哪里出现问题了
求1000之内的所有完数#include <iostream>
using namespace std;
int main()
{
cout << "完数有:";
int s = 0;
for (int i = 2; i < 1000; i++)
{
for (int j = 1; j < i; j++)
{
if (i % j == 0)
s += j;
}
if(i == s)
cout << i << " ";
}
cout << endl;
}