Binary digits: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,660: | Line 1,660: | ||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
{{works with|Julia|0.6}} |
|||
⚫ | |||
<lang julia>for n in (0, 5, 50, 9000) |
|||
@printf("%6i → %s\n", n, bin(n)) |
|||
end |
end |
||
⚫ | |||
# with pad |
|||
println("\nwith pad") |
|||
⚫ | |||
@printf("%6i → %s\n", n, bin(n, 20)) |
|||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre> 0 → 0 |
||
⚫ | |||
0 => 0 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
with pad |
|||
</pre> |
|||
0 → 00000000000000000000 |
|||
5 → 00000000000000000101 |
|||
50 → 00000000000000110010 |
|||
9000 → 00000010001100101000</pre> |
|||
=={{header|K}}== |
=={{header|K}}== |