Find whether a given number is a power of 4 or not | Function to check if x is power of 4 ; Driver program to test above function
function isPowerOfFour ( n ) { if ( n == 0 ) return false ; while ( n != 1 ) { if ( n % 4 != 0 ) return false ; n = n / 4 ; } return true ; } let test_no = 64 ; if ( isPowerOfFour ( test_no ) ) document . write ( test_no + " " ) ; else document . write ( test_no + " " ) ;