ok so im trying to write a program that calculates the third perfect number but i only reached as far as to calculate if a number is perfect:
Code:
#include <iostream>
using namespace std;
int main()
{
int pernum, total = 0;
cout << "Enter an interger: ";
cin >> pernum;
for (int i = 1; i < pernum; ++i)
{
if (pernum % i == 0)
total += i;
}
if (pernum == total)
cout << "Your number is a perfect number!" << endl;
else
cout << "Your number is not a perfect number" << endl;
return 0;
}
i was just wondering where do i go from here to get the third perfect number which is 496