June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
17
Task/100-doors/Visual-Basic/100-doors.vb
Normal file
17
Task/100-doors/Visual-Basic/100-doors.vb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Public Sub Doors100()
|
||||
' the state of a door is represented by the data type boolean (false = door closed, true = door opened)
|
||||
Dim doorstate(1 To 100) As Boolean ' the doorstate()-array is initialized by VB with value 'false'
|
||||
Dim i As Long, j As Long
|
||||
|
||||
For i = 1 To 100
|
||||
For j = i To 100 Step i
|
||||
doorstate(j) = Not doorstate(j)
|
||||
Next j
|
||||
Next i
|
||||
|
||||
Debug.Print "The following doors are open:"
|
||||
For i = 1 To 100
|
||||
' print number if door is openend
|
||||
If doorstate(i) Then Debug.Print CStr(i)
|
||||
Next i
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue