can help me please

How do I work this in C + +
(Perfect Numbers) An integer is said to be a perfect number if the sum of its factors, including 1 (but not the number itself), is equal to the number. For example, 6 is a perfect number, because 6 = 1 + 2 + 3. Write a function perfect that determines whether parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000.
can to help me in this question because I am a beginner in c + + and kept be grateful to you
I'm busy now this my code to calculate if the number is perfect. Complete the rest of your assignment. It gonna be good starting

1
2
3
4
5
6
7
8
9
10
11
12
13
int n, sum=0, i=0;

	cout << "Enter the number: ";
	cin >> n;
	while(sum<n)
	{
		sum += ++i;
		if (sum == n)
		{
			cout << "It is perfect number";
				break;
		}
	}
Last edited on
Thank you very much
I will try
Topic archived. No new replies allowed.