Logic functions. Perfect Numbers
Problem
A perfect number is a number equal to the sum of all its divisors less than itself (for example, the number 6=1+2+3). Write a program that takes a natural number N and determines whether the number N is perfect. Use the function to find the sum of the divisors of a number and the boolean function to check whether the number is perfect or not.
Input: input string contains natural number  ;N .
Output: if number N – perfect, the program should output the word 'YES', otherwise – the word 'NO'.
Examples.
Input |
Output |
28 |
YES |
29 |
NO |