Perfect number

This is a discussion on Perfect number within the C++ Programming forums, part of the General Programming Boards category; Ladies and Gentlemen, does anyone have a clue as to writing a formula to test for Perfect number? Example: 1+2+3=6 ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    34

    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
    http://members.ebay.com/aboutme/the_ski/

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    10
    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";
    }
    }

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    34
    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.
    http://members.ebay.com/aboutme/the_ski/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Perfect number and divisors
    By Lissa in forum C Programming
    Replies: 31
    Last Post: 10-24-2008, 02:36 PM
  2. xor linked list
    By adramalech in forum C Programming
    Replies: 23
    Last Post: 10-14-2008, 11:13 AM
  3. Issue w/ Guess My Number Program
    By mkylman in forum C++ Programming
    Replies: 5
    Last Post: 08-23-2007, 02:31 AM
  4. Random number + guessing game trouble
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-08-2007, 04:33 AM
  5. Perfect number...
    By Argo_Jeude in forum C++ Programming
    Replies: 8
    Last Post: 07-12-2005, 02:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21