*/ Learning Objectives Using Iteration More on Writing Interactive Programs Perf
ID: 3620100 • Letter: #
Question
*/ Learning Objectives Using Iteration More on Writing Interactive Programs Perfect numbers are positive integers n such that n = s(n), where s(n) is the restricted divisor function (i.e., s(n) is the son of proper divisors of n). A positive proper divisor is a positive divisor of a number, excluding the number itself. For example, the proper divisors of 12 are 1, 2, 3, 4, and 6. The first two perfect numbers are: 6 = 1 + 2 + 3 28 = 1 + 2 + 4 + 7 + 14 Perfect numbers were deemed to have important numerological properties by the ancients, and were extensively studied by the Greeks, including Euclid. Perfect numbers are also intimately connected with a class of numbers known as Messene primes, which are prime numbers of the form Mp = 2P - 1. The Perfect number Checker Program Write a program consisting of only the main function, called perfectchecker.cpp. When your program begins, the user is prompted to enter a positive integer. Your program should then determine whether the number is a perfect number. If it is not a perfect number, your program displays the number with a statement indicating that the number is not a perfect number. On the other hand, if the number is a perfect number, your program should display a statement indicating that the number is a perfect number and then show how the sum of proper divisors of the number is equal to the number. Additional Requirements If the user enters a non - positive integer, your should indicate that the number entered is invalid. A typical program interactions would be: Be sure to use descriptive names for all identifiers you define in your program. Follow the C + + Coding Style Guidelines we discussed in class. Name your source file perfectchecker.cpp. Your source file must have the following header comments:
Explanation / Answer
please rate - thanksRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.