Description
Positive integers can be classified as abundant, deficient, or perfect. Abundant integers are those whose proper factors sum to a larger number. For example, 36 is an abundant
number because it's proper factors (1, 2, 3, 4, 6, 9, 12, and 18) sum to 55 which is greater than 36. Deficient integers are those whose proper factors sum to a smaller number. For
example, 27 is a deficient integer because it's proper factors (1, 3, 9) sum to 13 which is less than 27. Perfect integers are those whose proper factors sum to exactly that number.
For example, 28 is a perfect integer because it's proper factors (1, 2, 4, 7, and 14) sum to exactly 28.
Given a positive integer value, determine if it is abundant, deficient, or perfect. Also list its proper factors and the sum of those proper factors.
1. Prompt for and accept as input a positive integer having a minimum of one digit. You do not need to edit this input. Only valid positive integer values will be entered.
2. Read the number from the standard input device.
3. Display the output as shown in the Test Data below.
4. Each input number can be tested by rerunning the application.
Input
Output
36
Abundant. Factors are: 1 2 3 4 6 9 12 18
Sum is: 55
27
Deficient. Factors are: 1 3 9
Sum is: 13
28
Perfect. Factors are: 1 2 4 7 14
Sum is: 28
11
Deficient. Factors are: 1
Sum is: 1
100
Abundant. Factors are: 1 2 4 5 10 20 25 50
Sum is: 117
6
Perfect. Factors are: 1 2 3
Sum is: 6