Friday, May 14, 2010

How would I write a C program with endfile-controlled and for loops to detect a perfect number?

I'm trying to write a program that can detect perfect numbers, i.e., numbers that are equal to the sum of their divisors. (For example: 6 = 1 + 2 +3.)





It should be able to accept and integer and return the sum of the divisors. I'm going to use % to determine if a number is a perfect divisor.





Can anyone give me some help with this?How would I write a C program with endfile-controlled and for loops to detect a perfect number?
http://pastebin.com/mc13f1d1
  • make up
  • No comments:

    Post a Comment