A number is known as a perfect number - if sum of its divisors (excluding itself) is equal to the number, deficit – if sum is less than number, abundant – if sum is greater than number. Write an algorithm that checks a number for perfect, deficit and abundant.
e.g, 6, its divisors sum = 1 + 2 + 3 = 6. As sum = number, so number is perfect