# Perfect number

• 10-30-2001
TheSki
Perfect number
Ladies and Gentlemen, does anyone have a clue as to writing a formula to test for Perfect number?

Example:

1+2+3=6 6 is a perfect number

1+2+3+4=10 10 is not a perfect number. Supposedly a perfect number is a positive number greater then 2 whose factors add up to the number itself.

I am writing a program that requires the user to input a potential number, test it, if it is true, then print out the factors. If it is not a perfect number, then say Sorry your number is not perfect.

All your help is greatly appreciated as you have done a wonderful job of helping me in the past.

The Ski
• 10-30-2001
DaRk\$nAkE
make a function with things like this in it
if(number > 2)
{
if(do you factor act her cause i don't get that part)
{
cout<< "perfect number";
}
else
{
cout<< "not a perfect number";
}
}
• 10-30-2001
TheSki
Thanks, but that is not what I am looking for. I am looking for a mathmatical formula that will test a number to see if it is perfect. One of the classmates on my other board helped me out. Thank you.