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: using System ; class GFG { static int FlipBits ( int n ) { return n -= ( n & ( - n ) ) ; } public static void Main ( String [ ] args ) { int N = 12 ; Console . Write ( " The ▁ number ▁ after " + " unsetting ▁ the ▁ " ) ; Console . Write ( " rightmost ▁ set ▁ bit : ▁ " + FlipBits ( N ) ) ; } }