Need help finishing part 1 of my school assignment with perfect numbers.

Find the perfect numbers between a starting value and a finishing value entered by the users. Display the results to the screen. YOU MUST DESIGN YOUR SOLUTION WITH FUNCTIONS.

I have like 80% done but i dont understand what else to do. It needs to display the perfect numbers between the starting and finishing value. e.g. 28 and 429.


#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;

void calcdiv(int number)
{
for (int i=1;i<=number/2;i++)
{
if (number % i == 0)
{
cout << i << endl;
}
}
}

int main()
{
int i;
int number;

cout << "Enter Starting Value.";
cin >> i;

cout << "Enter Finishing Value." << endl;
cin >> number;


calcdiv(i%number);

return 0;
}
Thank you!
Last edited on
Topic archived. No new replies allowed.