Binary digits: Difference between revisions
Content added Content deleted
Line 445: | Line 445: | ||
9000 -> 一〇〇〇一一〇〇一〇一〇〇〇</pre> |
9000 -> 一〇〇〇一一〇〇一〇一〇〇〇</pre> |
||
=={{header|Applesoft BASIC}}== |
|||
<lang ApplesoftBasic> 0 N = 5: GOSUB 1:N = 50: GOSUB 1:N = 9000: GOSUB 1: END |
|||
1 LET N2 = ABS ( INT (N)) |
|||
2 LET B$ = "" |
|||
3 FOR N1 = N2 TO 0 STEP 0 |
|||
4 LET N2 = INT (N1 / 2) |
|||
5 LET B$ = STR$ (N1 - N2 * 2) + B$ |
|||
6 LET N1 = N2 |
|||
7 NEXT N1 |
|||
8 PRINT B$ |
|||
9 RETURN</lang> |
|||
{{out}} |
|||
<pre>101 |
|||
110010 |
|||
10001100101000 |
|||
</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
<lang AutoHotkey>MsgBox % NumberToBinary(5) ;101 |
<lang AutoHotkey>MsgBox % NumberToBinary(5) ;101 |