A perfect number is one for which the sum of its divisors (excluding the number) is equal to the number itself. For examples 6 is perfect since the three divisors of 6 (excluding 6) are 1, 2, and 3 which add up to 6. The number 8 however has divisors 1, 2, 4 which add up to 7 so 8 is not perfect.

Write a Java program that will determine and print the first 4 perfect numbers one per line.

Recommended Answers

All 8 Replies

Didn't your homework assignment include some resources to get you started?

It did. It included a very clear description of what's required.
The kid's classroom instruction and course documentation will contain everything else it needs except a mind.
IOW what we have here is just another lazy homework kiddo.

i need just some idea

i didnt ask to u ppl to solve my question but plz give me some idea to solve it

Another interesting type of number is known as a perfect number. A perfect number is one for which the sum of its divisors (excluding the number) is equal to the number itself. For examples 6 is perfect since the three divisors of 6 (excluding 6) are 1, 2, and 3 which add up to 6. The number 8 however has divisors 1, 2, 4 which add up to 7 so 8 is not perfect.

Write a Java program that will determine and print the first 4 perfect numbers one per line.

gys i need just some idea how to make it n i will solve it thn..

commented: No effort and you can't even bother yourself to properly write a question. So lazy. -2

We can point you in the right direction, but first we need to see your attempts to figure it out. You can't just say "I don't know" with your paper clean. Play around with it and see where you get. If you don't get anywhere we'll help, but we need to see some of your efforts.

As a starter, do you know what the first four perfect numbers are? Do you know the next perfext number after 6? and tellingly,, Given a number n, how would you determine if it is perfect?

Another interesting type of number is known as a perfect number. A perfect number is one for which the sum of its divisors (excluding the number) is equal to the number itself. For examples 6 is perfect since the three divisors of 6 (excluding 6) are 1, 2, and 3 which add up to 6. The number 8 however has divisors 1, 2, 4 which add up to 7 so 8 is not perfect.

this ís the idea ..

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.