Given two positive numbers x and y, check if y is a power of x or not.
First line contains an integer, the number of test cases 'T'. Each test case should contain two positive numbers x and y.
Print 1 if y is a power of x, else print 0.
1 <= T <= 30
1 <= x <= 103
1 <= y <= 108
Explanation: 8 is a power of 2, but 3 is not a power of 1.
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.