Click here to Skip to main content
12,996,367 members (71,484 online)
Rate this:
Please Sign up or sign in to vote.
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 15-Oct-12 4:09am
Updated 15-Oct-12 4:13am
Wes Aday104.2K
Wes Aday 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.
geekbond 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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170609.2 | Last Updated 15 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100