#B3972. Decimal to Binary Conversion Process

    ID: 11629 Type: Default 1000ms 256MiB

Decimal to Binary Conversion Process

Decimal to Binary Conversion Process

Given a non-negative integer n, the task is to convert it into binary using the process of successive division by 2. In each step, you should:

  • Divide n by 2, obtaining a quotient and a remainder.
  • Print the quotient and remainder.
  • Replace n with the quotient.
  • Repeat until n becomes 0.

If the input is 0, no output should be produced. Note that all formulas are in \( \LaTeX \) format, e.g., the division step is shown as \( n \div 2 \).

inputFormat

A single non-negative integer n is given as input. (If n = 0, nothing is output.)

outputFormat

For every division step, output a line containing the quotient and the remainder separated by a space. For example, if the input is 13, the output should be: 6 1 3 0 1 1 0 1

sample

13
6 1

3 0 1 1 0 1

</p>