n = gets.to_i i = 0 m = n while true do amari = m % 2 printf( "%d\n" , amari ) m = m / 2 if m <= 0 then break end i += 1 end