Given a number x and two positions (from right side) in binary representation of x, write a program that swaps n bits at given two positions and returns the result.
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is X, P1, P2 and N. X is a number, P1 and P2 is two given position and swaps N number of bits at given two position.
Print the result.
1 ≤ T ≤ 15
1 ≤ X ≤ 200
0 ≤ P1 < P2 ≤ 8
1 ≤ N ≤ 5
47 1 5 3
28 0 3 2
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.