September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
16
Task/Binary-digits/BASIC/binary-digits-2.basic
Normal file
16
Task/Binary-digits/BASIC/binary-digits-2.basic
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
FOR num% = 0 TO 16
|
||||
PRINT FN_tobase(num%, 2, 0)
|
||||
NEXT
|
||||
END
|
||||
|
||||
REM Convert N% to string in base B% with minimum M% digits:
|
||||
DEF FN_tobase(N%,B%,M%)
|
||||
LOCAL D%,A$
|
||||
REPEAT
|
||||
D% = N%MODB%
|
||||
N% DIV= B%
|
||||
IF D%<0 D% += B%:N% -= 1
|
||||
A$ = CHR$(48 + D% - 7*(D%>9)) + A$
|
||||
M% -= 1
|
||||
UNTIL (N%=FALSE OR N%=TRUE) AND M%<=0
|
||||
=A$
|
||||
Loading…
Add table
Add a link
Reference in a new issue