#C12776. Perfect Number Checker
Perfect Number Checker
Perfect Number Checker
Given a positive integer \(n\), determine whether it is a perfect number. A perfect number is defined as a positive integer that is equal to the sum of its proper divisors (i.e., all divisors excluding the number itself). For example, 6 is a perfect number because \(1 + 2 + 3 = 6\), and 28 is a perfect number because \(1 + 2 + 4 + 7 + 14 = 28\).
This problem requires you to implement a solution that reads an integer from the standard input and prints either True
or False
to the standard output based on whether the number is perfect or not.
inputFormat
The input consists of a single integer \(n\) (\( -10^9 \le n \le 10^9 \)). If \(n\) is non-positive, it is not considered a perfect number. Your program should read the integer from the standard input.
outputFormat
Print True
if the given number is a perfect number, otherwise print False
. The output should be written to the standard output.
6
True