Ask Experts Questions for FREE Help !
Ask
    ziba's Avatar
    ziba Posts: 1, Reputation: 1
    New Member
     
    #1

    Oct 27, 2007, 05:40 PM
    coding a c++ program
    I need a fast help to code the following program which is really easy:

    I have to develop a program to analyze one or more numbers entered by a user and see if the number is a prime # or a perfect # and out put a list of divisors of all perfect numbers and noneprime numbers.

    Hint: A prime # is a # whose only exact divisors are 1 and the number itself(such 2,3,5,7) and a perfect # is a # whose exact divisors (except the number itself) sum to equal the number.(For example #6 has 3 divisors(not including 6). The divisors of 6(1,2,3)sum to equal the number.

    I will appreciate your help if u give me the answer within 24 hours.
    asterisk_man's Avatar
    asterisk_man Posts: 476, Reputation: 32
    Full Member
     
    #2

    Oct 27, 2007, 06:05 PM
    We're not here to do your homework. Next time try asking questions before the assignment is due tomorrow. We can help you with questions and review your answer but we won't do the work for you.
    red_cartoon's Avatar
    red_cartoon Posts: 52, Reputation: 6
    Junior Member
     
    #3

    Nov 22, 2007, 11:04 AM
    If you are new to programming, then this is certainly not a good idea to start working on these problem just the day before submission. I hope you are in a much better situation than that.

    For checking whether a number is prime or not, you run a loop I = 1 to I = sqrt(n) and see if I divides n without any reminder. If none of these can divide n without a reminder then n is prime.

    For perfect number checking, loop from 1 to n and collect the divisors as you go through the loop. Add them to see whether they sum up to n or not. That's it.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Color coding on line does not match jack color coding [ 11 Answers ]

The line going into the old phone jack has orange, green, blue and 3 white wires in it. Bought a new jack at Radio Shack and the colors of the wires in the replacement jack are red, green, black and yellow. Verizon repair was at best, snotty in telling me "we cannot tell you how to do repairs...

HTML Coding [ 3 Answers ]

Can someone tell me how to designate font and color using html?

Software coding [ 2 Answers ]

Is software Fixed Asset or not?

Color Coding [ 1 Answers ]

If Blue,red,black And Green Color Is Used While Writing ,what Signifies Blue,what Signifies Red,what Signifies Black And What Signifies Green?


View more questions Search