Click here to Skip to main content
15,896,466 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
So, here is the problem:

Suppose m and n are integers and m is nonozero. Recall that m is called a divisor of n if n = mt for some integer t; that is, when m divides n, the remainder is 0. Moreover, m is called a proper divisor of n if m < n and m divides n. A positive integer is called perfect if it is the sum of its positive proper divisors. For example, the positive proper divisiors of 28 are 1, 2, 4, 7, and 14 and 1 + 2 + 4 + 7 + 14 = 28. Therefore, 28 is a perfect. Write a program that do the following:

a. Output the first four perfect numbers
b. Input a positive integer number and determine whether the integer is perfect. Validate the input. Ask the user to enter another input until the user enters 0.

You are required to implement the following function:

bool sumOfAllProperDivisors (int m)
The function returns true if the sum of positive proper divisors of number m is equal to m;otherwise, it returns false.

You NEED to use bool sumOfAllProperDivisors. How can we make this program work?
Posted
Updated 15-Oct-12 4:13am
v3
Comments
[no name] 15-Oct-12 10:13am    
First: this is not a problem. This is homework. Second: How do you make this program work? By writing some code. Pay attention in class. Read your textbook.
Sergey Alexandrovich Kryukov 15-Oct-12 15:00pm    
This is the answer. Even though there is no a question.
--SA
Akinmade Bond 15-Oct-12 10:29am    
Oh, sorry. CP does not answer homework. Listen in class and atleast you could've written some of what you've tried and we'll be happy to point you in the right direction.

1 solution

Why do we not do your homework. (Compliments of JSOP)[^]

This is not a difficult problem. The logic required is clearly laid out for you in your question text. I would suggest you break down the question into its smaller components and solve each component separately. Then tie the components together into your final solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900