Print ' K ' th least significant bit of a number | C # code to print ' K ' th LSB ; Function returns 1 if set , 0 if not ; Driver code ; Function call
using System ; class GFG { static bool LSB ( int num , int K ) { bool x = ( num & ( 1 << ( K - 1 ) ) ) != 0 ; return ( x ) ; } static void Main ( ) { int num = 10 , K = 4 ; if ( LSB ( num , K ) ) Console . Write ( "1" ) ; else Console . Write ( "0" ) ; } }