Hey guys! I got my first C++ homework assignment and the homework assignment I have to do is: A perfect number is a positive integer such that the sum of the proper divisors equals the number.
I have received 3 errors on this and could you point me out to those errors and show me how to correct it?
Here is the coding I have done so far:
using namespace std;
int main_num=0, test_num, divisor, sum_of_divisors;
while(cotinue == 1)
while(valid_input == 0)
cout<<"\n\nPlease input an integer: \n";
cout<<"The perfect positive numbers that are less than or equal to "<<main_num<<" include:\n";
for(test_num=1; test_num <= main_num; ++test_num)
for(divisor=1, sum_of_divisors=0; (divisor <= ((test_num / 2)+1)); ++divisor)
if((test_num % divisor) == 0)
sum_of_divisors = sum_of_divisors + divisor;
if(sum_of_divisors == test_num)
Let me know