Program #4
Write a program that includes two functions. The First (named isPerfect) receives no parameters and does not return any parameters. It simply calculates and prints all the perfect numbers between 1 and 10000. A perfect number is a number whose sum of its divisors (not including the number itself) add up to the number
Determine through processing and print each perfect number and its divisors from 1 to 10000 (there are only 4). Pause the screen and clear the screen between outputs. The output for each perfect number should be like the following example.
6 is perfect. Its divisors are
1, 2, 3
The second function (named isPrime) that receives an integer as a parameter and returns a boolean that indicates whether the number is prime or not. Allow the user to enter a number between 2 and 10000 and printout whether it is prime or not. Example of prompts and output
Please enter an integer and I will tell you if it is prime: 19
19 is prime
Would you like to do another (y/n)? y
…clear screen
Please enter an integer and I will tell you if it is prime: 21
21 is not prime
Would you like to do another (y/n)? n
…end the program
Clear the screen between runs. Do not rerun the perfect code, just the prime.
Make sure you use function prototypes and no globals. Make sure your output is like the above.
Check for invalid input for the prime. If an invalid number is entered, display an error message and then go to the prompt that asks whether he wants to do another.
Name the program numbers.cpp
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more