We can do this application using bit-manipulation using two method:-

- Left Shift operator.

`Note:- In the Left Shift method , we take example n=5 and k=3`

n= 00000.....0101 (5)

1= 00000.....0100 (using left shift we shift the value 1)

o/p= 00000.....0100 ( output is any +ve integer that means the at k-th position its set , 1 & 1= 1).

2. Right Shift operator.

`Note:- In the Right shift method , we take the same example n=5 and k=3`

n= 0000....0101 (5)

n>>(3-1) (right shift of n>>2)

After the right shift operator we have

n= 0000....0001

1= 0000....0001

n&1= 0000....0001 ( we have to get the value equivalent to 1 for the kth bit is set or not judgement.)