A number m is called a proper divisor of n if m<n and m divides n. A positive integer is perfect if it is the sum of its proper positive divisors. For example 28 is perfect because 1 + 2 + 4 + 7 + 14 = 28 . 1, 2, 4, 7, and 14 are the proper positive divisors of 28.
Write a java program ask the user to enter any positive number and the program will find if this number is perfect or not;

Recommended Answers

All 5 Replies

How far have you got? What’s stopping you?

By all means copy a solution from Rosettacode.
Of course that probably means you would get resounding F grade for plagiarism.
The whole idea is for you to work out how to do it for yourself. That’s how you learn.

Sorry James. And I'm OK with the -1 (F) grade for that reply. Sometimes the student needs a hard zing on an assignment to learn they have to write it themselves. However sometimes you'll get a hit on plagiarism checkers and it is the students work. The assignment here is one with hundreds if not thousands of solves on the web so it's going to be hard to not see same or similar solves from the students.

For the OP, get in here with what stopped you.

commented: ;-) +0

Frankly the plagiarism thing was a slightly empty threat. The real point is that starting with someone (anyone) else's solution will not teach you how to write a program. Working it out for yourself can be a painful experience, but that's the only way to learn.
Looking up existing solutions is, of course, what real programmers do in real life. But that's not the right place for a novice to start.
:-)
J

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.