Odious number | Function to get no of set bits in binary ; Check if number is odious or not ; Driver Code
< ? php function countSetBits ( $ n ) { $ count = 0 ; while ( $ n ) { $ n &= ( $ n - 1 ) ; $ count ++ ; } return $ count ; } function checkOdious ( $ n ) { return ( countSetBits ( $ n ) % 2 == 1 ) ; } $ num = 32 ; if ( checkOdious ( $ num ) ) echo " Yes " ; else echo " No " ; ? >