#K51062. 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 a positive integer that is equal to the sum of its proper positive divisors, excluding the number itself. Formally, for a number \( n \), if \( \sigma(n) - n = n \), then \( n \) is a perfect number. For example, 6 is perfect because \( 1 + 2 + 3 = 6 \).
Your task is to read an integer from standard input and print True
if the number is perfect, otherwise print False
.
inputFormat
The input consists of a single line containing one integer \( n \) (where \( 1 \le n \le 10^8 \)).
outputFormat
Print a single line: True
if the input number is a perfect number, otherwise False
.
6
True