Dsa
Bit Manipulation
Easy
Clear Specific Bit
Given an integer, clear (set to 0) the bit at a specific index. The index is 0-based. For example, to clear the bit at index 1 of the integer 5 (binary: 101), the result should be 4 (binary: 100).
Input Format:
- The first line contains an integer x (0 ≤ x ≤ 2^31 - 1).
- The second line contains an integer index (0 ≤ index < 31).
Output Format:
- Print the new integer after clearing the specified bit.
Example Input:
5
1
Example Output:
4
Key concepts
bit_manipulationclearingbitwise
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now