Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

i want to write a program in c to show a perfect numbers between 1 to 10000 and i don't know how to start

OpenStudy (espex):

Some assumptions: You know C language You know how to formulate these perfect numbers A good place to start is with a pen and paper to outline all of the steps you would take to produce these numbers, then some sudo code, then actual code.

OpenStudy (anonymous):

i am having difficulty with the perfect numbers concepts

OpenStudy (espex):

Well a quick search through wikipedia shows that a perfect number is 2^(p−1)(2p−1), so this could be done easily with a loop.

OpenStudy (espex):

The previoius is for even perfect numbers and from the looks of it finding an odd perfect number will require quite a bit more work.

OpenStudy (anonymous):

The program has no user input. Using the 'Mersenne exponential method' involves the simple implementation of a formula with a lookup table. This bypasses the usefulness of the assignment - namely the learning of loop and conditional statements (while, at the same time, avoiding the use of pointers). Therefore, using this method is not adequate to pass the assignment - you must test each integer individually for its 'perfectness'.

OpenStudy (espex):

Well you could start with a nested loop: for (i = 1; i< 1000;i++){ for(j=1; j< 100; j++){ num = i^j(i^(j+1)-1); printf("The number %d to the power of %d is: %d\n",i, j, num); } } This would run every number between 1 and 1000 through the formula described for the even set of perfect numbers. As for the check, that gets a little more specific and depends on what all the assignment entails.

OpenStudy (espex):

http://en.wikipedia.org/wiki/Perfect_number You will also need to check if the number (j) is prime.

OpenStudy (espex):

Oh, here ya go. http://mathforum.org/dr.math/faq/faq.perfect.html#calculate

OpenStudy (anonymous):

thank you my friend i am gone do some reading and then start trying

OpenStudy (espex):

:) You're welcome.

OpenStudy (anonymous):

well start to write your static array , that would be a really good start :)

OpenStudy (anonymous):

i ges u gat all help u needed......

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!