Assume you are given a variable named num that holds a non-negative integer.
Create a variable named last_bit that holds the rightmost bit of num's binary representation — that is, 0 when num is even and 1 when num is odd.
This is the very first quantity computed in the integer-to-binary algorithm: the next bit you would prepend.