I am in dire need of help. I have written this program to output the first 4 perfect number, numbers whose divisors can be added to produce the original number, and the code just sits there and does nothing when ran.
#include<iostream>
using namespace std;
int main()
{ int counter=1;
int num=2;
int sum=0;
while(counter<=4)
{ int i=1;
while(i<num)
{ if(num%i==0)
sum=sum+i;
i=i+1;
}
if(sum==num)
{ cout<<num<<endl;
counter=counter+1;
num=num+1;
}
}
system ("PAUSE");
return 0;
}