Find whether a given number is a power of 4 or not | C # program to check if given number is power of 4 or not ; Driver Code
using System ; class GFG { static bool isPowerOfFour ( int n ) { return n != 0 && ( ( n & ( n - 1 ) ) == 0 ) && ( n & 0xAAAAAAAA ) == 0 ; } static void Main ( ) { int test_no = 64 ; if ( isPowerOfFour ( test_no ) ) Console . WriteLine ( " { 0 } ▁ is ▁ a ▁ power ▁ of ▁ 4" , test_no ) ; else Console . WriteLine ( " { 0 } ▁ is ▁ not ▁ a ▁ power ▁ of ▁ 4" , test_no ) ; } }