September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -1,14 +1,12 @@
10 N = 5 : GOSUB 100
20 N = 50 : GOSUB 100
30 N = 9000 : GOSUB 100
40 END
90 REM *** SUBROUTINE: CONVERT DECIMAL TO BINARY
100 N2 = ABS(INT(N))
110 B$ = ""
120 FOR N1 = N2 TO 0 STEP 0
130 : N2 = INT(N1 / 2)
140 : B$ = STR$(N1 - N2 * 2) + B$
150 : N1 = N2
160 NEXT N1
170 PRINT B$
180 RETURN
PRINT FNbinary(5)
PRINT FNbinary(50)
PRINT FNbinary(9000)
END
DEF FNbinary(N%)
LOCAL A$
REPEAT
A$ = STR$(N% AND 1) + A$
N% = N% >>> 1 : REM BBC Basic prior to V5 can use N% = N% DIV 2
UNTIL N% = 0
=A$