Check whether K | C # program to check if k - th bit of a given number is set or not using right shift operator ; Driver code
using System ; class GFG { static void isKthBitSet ( int n , int k ) { if ( ( ( n >> ( k - 1 ) ) & 1 ) > 0 ) Console . WriteLine ( " SET " ) ; else Console . WriteLine ( " NOT ▁ SET " ) ; } static public void Main ( ) { int n = 5 , k = 1 ; isKthBitSet ( n , k ) ; } }