September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,16 +1,10 @@
|
|||
FOR num% = 0 TO 16
|
||||
PRINT FN_tobase(num%, 2, 0)
|
||||
NEXT
|
||||
END
|
||||
# DecToBin.bas
|
||||
# BASIC256 1.1.4.0
|
||||
|
||||
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$
|
||||
|
||||
dim a(3) #dimension a 3 element array (a)
|
||||
a = {5, 50, 9000}
|
||||
|
||||
for i = 0 to 2
|
||||
print a[i] + chr(9) + toRadix(a[i],2) # radix (decimal, base2)
|
||||
next i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue