text: Toggling k | C # program to toogle k - th bit of a number ; main function
code: using System ; class GFG { static int toggleKthBit ( int n , int k ) { return ( n ^ ( 1 << ( k - 1 ) ) ) ; } public static void Main ( ) { int n = 5 , k = 1 ; Console . WriteLine ( toggleKthBit ( n , k ) ) ; } }