A Kaprekar number is a number whose square when divided into two parts the sum of those parts is equal to the original number and none of the parts has value 0.Now given a number, your task is to check if it is Kaprekar number or not.
Input : n = 45 Output : 1 Explanation : 452 = 2025 and 20 + 25 is 45 Input : n = 297 Output : 1 Explanation: 2972 = 88209 and 88 + 209 is 297 Input : n = 10 Output : 0 Explanation: 102 = 100. It is not a Kaprekar number even if sum of 100 + 0 is 100. This is because of the condition that none of the parts should have value 0.
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each line contains an integer N.
For each test case in a new line print 1 if the no is a Kaprekar number else print 0.
1 <= T <= 10000
2 <= N <= 10000
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.