Question DSA-BIT-0013
MediumHow do you clear the k-th bit of n?
- A.
n | (1 << k)
- B.
n & ~(1 << k)
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Bit Manipulation question
How do you clear the k-th bit of n?
n | (1 << k)
n & ~(1 << k)
Sign up free to see the answer and a step-by-step explanation.
n ^ (1 << k) always
n << k