Check a Integer is power of 3 or not
Submissions: 1267   Accuracy:

33.03%

  Difficulty: Basic   Marks: 1

Given a positive integer, write a function to find if it is a power of three or not.

Input:
First line consists of T test cases. Only line of every test case consists of a 32-bit integer N.

Output:
Single line output, print "Yes" if integer is a power of 3 else "No"

Constraints:
1<=T<=100
1<=N<=(32-bit largest integer)

Example:
Input:

2
3
6
Output:
Yes
No

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

Contributor: Saksham Raj Seth
Author: saksham seth


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.