A positive integer is classified as being deficient, perfect, or abundant - depending on whether the sum of the divisors of N is less than, equal to, or greater than N. In summing the divisors, 1 is included, but N itself is not. For example, the divisors of 4 are 1 and 2; since 1 + 2 =3, is a deficient number. The divisors of 6 are 1,2, and 3; since 1+2+3 = 6, 6 is a perfect number. The divisors of 12 are 1, 2, 3, 4, and 6; since 1+2+3+4+6=16,12 is an abundant number. Write a program that accepts a positive integer as input, and reports its classification.
Comments
Leave a comment