Here if (n&1) is doing that if it is true it is 1; and if it is not it is zero

here if (n&1) is doing that if it is true it is 1; and if it is not it is zero

hello @Aditya-Kushwaha-914550392281281
n&1 -> returns least significant bit of n . if least significant bit of n is 1 then n&1 will be 1 (or u can say true) otherwise n&1 will be 0(false).

if n is odd then n&1 will always be 1.
otherwise n&1 will be 0.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.