#B2127. Perfect Numbers Between 2 and n
Perfect Numbers Between 2 and n
Perfect Numbers Between 2 and n
Given a positive integer n, find and print all perfect numbers between 2 and n (inclusive), one per line.
A perfect number is a natural number that is equal to the sum of its proper divisors (divisors excluding the number itself). For example, \(6 = 1+2+3\) and \(28 = 1+2+4+7+14\).
inputFormat
The input consists of a single integer n (\(n \ge 2\)).
Note: The input is provided on the standard input.
outputFormat
Output all the perfect numbers between 2 and n (inclusive), each on a separate line. If there are no perfect numbers in this range, output nothing.
sample
30
6
28
</p>