Write down the function perfect which determines whether number is perfect number or not. This function must receive number and return true if number is perfect and false otherwise. Use this function in program which determines and prints all perfect numbers between 1 and 1000. Print divisors of each perfect number to confirm that number is indeed perfect as shown in sample output below.
The integer is said to be perfect number if sum of its divisors, including 1 (but not number itself), is equal to number. For instance, 6 is perfect number, because 6 = 1 + 2 + 3.
Sample output
Perfect integers between 1 and 1000:
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248