31 lines
649 B
Plaintext
31 lines
649 B
Plaintext
Dim Shared As Long lastsquare, nextsquare, lastcube, midcube, nextcube
|
|
|
|
Function squares() As Long
|
|
lastsquare += nextsquare
|
|
nextsquare += 2
|
|
squares = lastsquare
|
|
End Function
|
|
|
|
Function cubes() As Long
|
|
lastcube += nextcube
|
|
nextcube += midcube
|
|
midcube += 6
|
|
cubes = lastcube
|
|
End Function
|
|
|
|
lastsquare = 1 : nextsquare = -1 : lastcube = -1 : midcube = 0 : nextcube = 1
|
|
Dim As Long cube, square
|
|
cube = cubes
|
|
|
|
For i As Byte = 1 To 30
|
|
Do
|
|
square = squares
|
|
Do While cube < square
|
|
cube = cubes
|
|
Loop
|
|
If square <> cube Then Exit Do
|
|
Loop
|
|
If i > 20 Then Print square;
|
|
Next i
|
|
Sleep
|