text: Turn off the rightmost set bit | Set 2 | C ++ program to unset the rightmost set bit ; Unsets the rightmost set bit of n and returns the result ; Driver Code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; int FlipBits ( unsigned int n ) { return n -= ( n & ( - n ) ) ; } int main ( ) { int N = 12 ; cout << " The ▁ number ▁ after ▁ unsetting ▁ the " ; cout << " ▁ rightmost ▁ set ▁ bit : ▁ " << FlipBits ( N ) ; return 0 ; }