Highest power of two that divides a given number | CPP program to find highest power of 2 that divides n . ; Driver code
#include <iostream> NEW_LINE using namespace std ; int highestPowerOf2 ( int n ) { return ( n & ( ~ ( n - 1 ) ) ) ; } int main ( ) { int n = 48 ; cout << highestPowerOf2 ( n ) ; return 0 ; }