Binary digits: Difference between revisions

Content added Content deleted
(→‎J: simplify)
Line 2,808: Line 2,808:
</pre>
</pre>
=={{header|J}}==
=={{header|J}}==
Generate a list of binary digits and use it to select characters from string '01'.
<syntaxhighlight lang="j"> tobin=: -.&' '@":@#:
<syntaxhighlight lang="j"> tobin=: {&'01'@#:
tobin 5
tobin 5
101
101
Line 2,815: Line 2,816:
tobin 9000
tobin 9000
10001100101000</syntaxhighlight>
10001100101000</syntaxhighlight>
Uses implicit output.
Algorithm: Remove spaces from the character list which results from formatting the binary list which represents the numeric argument.


I am using implicit output.
=={{header|Java}}==
=={{header|Java}}==
<p>
<p>