Create a program that takes in a positive integer number from the user and searches for the number with the highest sum of divisors from the 1 to the user imputed number. The program then has to output the number in this range with the highest sum of divisors and the sum of its divisors in message like this: "Number 8 has a maximum sum of divisors 15".
So far I've created a while loop that prevents the user from proceeding if they don't enter a positive integer but I haven't been able to program the part that selects the number in the range with the highest sum of divisors and the sum of its divisors and the project is due tomorrow night.
This is what I have so far:
#include
Using namespace std;
Int main ()
{
Int x;
Cout<< "enter a positive integer";
Cin>>x;
While (x<0||x>20000)
{
Cout<<"positive integers only please";
Cin>>x;
}