Check if n is divisible by power of 2 without using arithmetic operators | function to check whether n is divisible by pow ( 2 , m ) ; if expression results to 0 , then n is divisible by pow ( 2 , m ) ; n is not divisible ; Driver Code
< ? php function isDivBy2PowerM ( $ n , $ m ) { if ( ( $ n & ( ( 1 << $ m ) - 1 ) ) == 0 ) return true ; return false ; } $ n = 8 ; $ m = 2 ; if ( isDivBy2PowerM ( $ n , $ m ) ) echo " Yes " ; else echo " No " ; ? >