Can someone explain to me why we do sum&1.

Thank you.

sum&1 is used to check whether the sum is odd or even.

sum&1 will return true value if sum is odd and return false value if it is even.

IF sum is even then you cannot fulfill the the both condition and if sum is odd you can always fulfill the both conditions. Thats’s it:)

1 Like