# L-6.5 MCS 260 Friday 27 June 2014 : binary expansion
"""
This first version prints the bits
in the order as they are computed.
We use divmod(), an intrinsic operation
on numeric types.
"""
print 'computing the binary expansion'
NRAW = raw_input('Give a number : ')
N = int(NRAW)
(N, R) = divmod(N, 2)
print R
while N > 0:
    (N, R) = divmod(N, 2)
    print R
