How to write a pseudocode program of perfect number

Item One- the amount of numbers to be tested, so that the program knows how many times to loop. the amount of values must be between 1 to 20 inclusive.

Item Two - the numbers that will be tested to ascertain whether they are perfect, defective or excessive numbers. these must be whole numbers and between 6 to 1000 inclusive.

please help with an answer to safe life..thank you

Recommended Answers

All 4 Replies

OK, so that's your homework. Now show us what you've done so far and what you are having problems with and someone might be able to help you.

Otherwise, I'm afraid to break it to you, but you're dead in the water here...

@ Happygeek, thanks for the respond, and this is my idea of the question but still am not sure if its right

public class PerfectNumbers
public static void main(String[]args)
int sum=1, x=1;
for(int num=1;num<20;num++)
System.out.println("\nThe factors are: ");

Your code is not valid java. You'll need to include all of your braces. Also, use the code button to post code.

for(int num=1;num<20;num++)

This does not include 20.


You'll need two more cases: one for defective numbers, and one for excessive numbers.

You'll need to work out a program that finds the sum of the proper divisors of a number first. An easy way to do it is trial division. For larger numbers, the powerset of all prime factors of the number will be faster.

i just need a plain pseudocode programming language...thanks for the tips, but still not helping

Be a part of the DaniWeb community

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