Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Learning Objectives • Using Iteration • More on Writing Interactive Programs Def

ID: 3617031 • Letter: L

Question

Learning Objectives

• Using Iteration

• More on Writing Interactive Programs

Definition 1. Perfectnumbers are positive integersn such thatn =

s(n),where s(n) isthe restricted divisor function (i.e., s(n) is the sum of

proper divisors ofn).

Definition 2.A positive properdivisor is a positive divisor of anumber,

excluding the number itself. Forexample, the proper divisors of 12 are 1, 2,

3, 4, and 6.

The first two perfect numbersare:

6 = 1 + 2 + 3

28 = 1 + 2 + 4 + 7 +14

Perfect numbers were deemed tohave important numerological properties by

the ancients, and wereextensively studied by the Greeks, including Euclid.

Perfect numbers are alsointimately connected with a class of numbers known

as Mersenne primes, which areprime numbers of the form M

p = 2p 1.

The Perfect Number Checker Program

Write a program consisting ofonly the main function, called perfectchecker.cpp.

When your program begins, theuser is prompted to enter a positive integer.

Your program should thendetermine whether the number is a perfect num-

ber. If it is not a perfectnumber, your program displays the number with

a statement indicating that thenumber is not a perfect number. On the

other hand, if the number is aperfect number, your program should display

a statement indicating that thenumber is a perfect number and then show

how the sum of proper divisorsof the number is equal to the number.

Duncan 1 Spring 2010

Iteration CSc 1253: Project #3

AdditionalRequirements

If the user enters anon-positive integer, your should indicate that thenumber

entered is invalid. A typicalprogram interactions would be:

Sample Run 1:

Enter a positive integer>0

Your input is invalid

Sample Run 2:

Enter a positive integer>5

5 is not a perfect number.

Sample Run 3:

Enter a positive integer>6

6 is a perfect number.

6 = 1 + 2 + 3

Sample Run 4:

Enter a positive integer>14

14 is not a perfect number.

Sample Run 5:

Enter a positive integer>28

28 is a perfect number.

28 = 1 +2 + 4 + 7 + 14

Explanation / Answer

please rate - thanks #include using namespace std; int main() {int num,i,sum=1; coutnum; if(num>0)    {for(i=2;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote