PDA

View Full Version : 100 doors



stapper
08-04-2017, 17:18
http://rosettacode.org/wiki/100_doors#



Uses "Console"

Dim doors(100) As Long
Dim i,j As Long
Array Assign doors(-1) = FALSE

For i = 1 To 100
For j = i To 100 Step i
doors(j) = Not(doors(j))
Next
Next

For i = 1 To 100
If doors(i)= -1 Then
PrintL "door " & i & " = open"
End If
Next

PrintL "Press a key to end program"

'---Wait for a key press
WaitKey