Given a number “n”, find if it is Disarium or not. A number is called Disarium if sum of its digits powered with their respective positions is equal to the number itself.
The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consist of one line. The first line of each test case consists of an integer N.
Corresponding to each test case, in a new line, print 1 if N is Disarium , else 0.
1 ≤ T ≤ 100
1 ≤ N ≤ 105
1. For first test case as 8^1+9^2 = 89 thus output is 1
2. For sec test case 8^1 + 0^2 = 8 thus output is 0
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.