Given a non-negative number N and two values L and R. The problem is to set all the bits in the range L to R in the binary representation of N.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains three integers N, L and R as input.

**Output:**

For each test case, set the bits in given range and print the modified number in new line.

**Constraints:**

1<=T<=100

1<=N<=2^{32}

1<=L<=R<=32

**Example:**

**Input:**

2

17 2 3

8 1 2

**Output:**

23

11

**Explanation:**

```
Input : N = 17, L = 2, R = 3
Output : 23
(17)
```_{10} = (10001)_{2}
(23)_{10} = (10111)_{2}
The bits in the range 2 to 3 in the binary
representation of 17 are set.

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.

cs_abhi | 102 |

PiyushPandey4 | 100 |

codefundo | 95 |

kya_bolti_public | 93 |

masterishaan19 | 74 |

PiyushPandey4 | 916 |

john_wick | 765 |

ASWATHAMA | 565 |

UsfShilpa | 556 |

akhyasharma01 | 547 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.