i am not able to comprehend the logic behind The while loop condition
What is (temp&1) == 1 condition in the while loop doing?
hello @JaveedYara
that condition is checking whether leftmost bit of temp is set or not.
(temp&1) will return left most bit and we are comparing it with 1.