Perfect Numbers
Submissions: 13854   Accuracy:

36.64%

  Difficulty: Easy
     

Given a number N, check if a number is perfect or not. A number is said to be perfect if sum of all its factors excluding the number itself is equal to the number.

Input:
First line consists of T test cases. Then T test cases follow .Each test case consists of a number N.

Output:
For each testcase, in a new line, output in a single line 1 if a number is a perfect number else print 0.

Constraints:
1 <= T <= 300
1 <= N <= 104

Example:
Input:
2
6
21
Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Author: Ayush Saluja


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.