Check if a number can be expressed as x^y
Submissions: 7988   Accuracy:

32.72%

  Difficulty: Basic   Marks: 1

Given a positive integer n, find if it can be expressed as xy where y > 1 and x > 0 and x and y both are both integers.

Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow . Each test cases contains an integer N.

Output:
For each test case in a new line print 1 if the number can be expressed as  xy else print 0.

Constraints:
1<=T<=1000
1<=n<=100

Example:
Input:

2
8
5
Output:
1
0

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

Author: Shubham Joshi 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.



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


to report an issue on this page.