AND operation
Submissions: 801   Accuracy:

34.2%

  Difficulty: Easy   Marks: 2

Given two integers L and R . Find the resultant after applying the series of Bitwise AND ( & ) operation on every natural number between the Range L and R (including both).

It is recommended to find the result without traversing whole range of given numbers

Input:
First line contains an integer 'T' denoting the number of test cases. Then T test cases follow. Each test case consists of a single line conaitning two space separated integers L and R.

Output:
Per test case print the required answer in a newline.

Constraints:
1<=T<=50
0<=L<=R<=2^32


Example:

INPUT:
4
8 13
34 36
22 30
2 3

OUTPUT:
8
32
16
2

Explanation
Input: For L = 8 and R = 13 
Output: 8 AND 9 AND 10 AND 11 AND 12 AND 13 =  â€‹8

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Hardik Gulati
Author: Mukesh Kumar 5


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.