Q:

Long integer number doesn't work for power of 8 in C++

I am trying to solve geeksforgeeks test case that Check if a Integer is power of 8 or not.
I have made test case using c++. In this program, when I provide long integer number like 8589934592. But, condition become false and test case failed.
#include <iostream>
using namespace std;

int main() 
{
    unsigned int n, n1;
    cin>>n; // Denoting the number of test cases

    for(int i = 0; i < n; i++)
    {
        cin>>n1; // An integer number

        while(n1 > 8)
        {
            n1 = n1 / 8;
        }

        if(n1 == 8)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    return 0;
}

So, Why test case does not work for long power of eight number?
Here is sample input:
2
307163648379016
8589934592

And desired output:
No
Yes

A:

I did some correction in my test case and solved that problem. 
First I have used % operator instead of / operator in while() loop condition which was silly mistake made by me.
Then, I have changed if number is equal to 1 then number is power of eight else number not power of eight.
My perfect working code:
#include <iostream>
using namespace std;

int main() 
{
    uint64_t n, n1;
    cin>>n; // Denoting the number of test cases

    for(int i = 0; i < n; i++)
    {
        cin>>n1; // An integer number

        while(n1%8 == 0)
        {
            n1 = n1 / 8;
        }

        if(n1 == 1)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Input:
2
307163648379016
8589934592

Output:
No
Yes

Thank you very much @Yunnosch to help me.

