Awhole number is said to be a perfect number if its factors,including 1 but not
ID: 3614972 • Letter: A
Question
Awhole number is said to be a perfect number if its factors,including 1 but not the number itself, sum to the number. Write a program that reads in a positive integer and determineswhether it is a perfect number. If the number is perfect, theprogram should also display its factors on the screen. Definea function perfect to determine whether a number is perfect, and afunction printFactors to print the factors, including 1 but not thenumber itself, of a given number on the screen.
Example:
Thisprogram determines whether a number is a perfect number.
Enter a positive integer: 6
6 isa perfect number.
Factors of 6: 1 2 3