Given an integer, write a function to determine if it is a power of two.
class Solution {
public:
bool isPowerOfTwo(int n) {
while(n)
{
if(n%2==0)n=n/2;//不断除2,看能否最终得到1
else break;
}
if(n==1)return true;
else return false;
}
};