22 lines
500 B
Text
22 lines
500 B
Text
REM "100 Doors" program for QB64 BASIC (http://www.qb64.net/), a QuickBASIC-like compiler.
|
|
REM Author: G. A. Tippery
|
|
REM Date: 12-Feb-2014
|
|
REM
|
|
REM Unoptimized (naive) version, per specifications at http://rosettacode.org/wiki/100_doors
|
|
|
|
DEFINT A-Z
|
|
CONST N = 100
|
|
DIM door(N)
|
|
|
|
FOR stride = 1 TO N
|
|
FOR index = stride TO N STEP stride
|
|
LET door(index) = NOT (door(index))
|
|
NEXT index
|
|
NEXT stride
|
|
|
|
PRINT "Open doors:"
|
|
FOR index = 1 TO N
|
|
IF door(index) THEN PRINT index
|
|
NEXT index
|
|
|
|
END
|