computer programming solving

help me to solve this: a perfect number is a positive integer that is equal to sum of all those positive integers (excluding itself) that divide it evenly.For example,6 is a perfect number because its divisors (excluding itself) are 1,2,and 3,and because 6=1+2+3.Write a program that reads a positive integer as input and identifies it as perfect number or not.Allow the user to retry the program if desired.....how i wish i can solve this problem!
If you already stated the exact procedure to solve it, what exactly is the problem?
I think he's having trouble figguring out how to turn what he said into code.

As helios has stated, you have already stated what you need to do. You just have to put it in terms that the computer can understand.

First you input a number from the user. Then you have to get it's devisors (excluding itself).

I think the best way is to loop from 1 to the (number -1) and modulo the input number by the loop number looking for 0. If the modulo results in a 0, you have a number that devides evenly into your inputted number.

Once you have all the numbers, add them together. If they equal your original number, then viola! Perfect number. If not, then it's not a Perfect Number.
Topic archived. No new replies allowed.