How to resolve the algorithm Loops/For with a specified step step by step in the FreeBASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Loops/For with a specified step step by step in the FreeBASIC programming language
Table of Contents
Problem Statement
Demonstrate a for-loop where the step-value is greater than one.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Loops/For with a specified step step by step in the FreeBASIC programming language
Source code in the freebasic programming language
' FB 1.05.0 Win64
For i As Integer = 1 To 21 Step 2
Print i; " ";
Next
Print
Sleep
Public Sub Main()
Dim siCount As Short
For siCount = 1 To 50 Step 5
Print "Gambas is great!"
Next
End
10 FOR I = 1 TO 21 STEP 2
20 PRINT I;
30 NEXT I
100 FOR I=1 TO 10 STEP 2
110 PRINT I
120 NEXT
for i = 2 to 8 step 2
print i; ", ";
next i
print "who do we appreciate?"
end
For i = 0 To 100 Step 2
TextWindow.WriteLine(i)
EndFor
10 FOR I = 1 TO 21 STEP 2
20 PRINT I; " ";
30 NEXT I
40 END
10 FOR I = 1 TO 21 STEP 2
20 PRINT I;
30 NEXT I
10 FOR I=1 TO 10 STEP 2
20 PRINT I
30 NEXT
For i = -15 To 25 Step 5
Debug i
Next i
For i = 10 To 0 Step -2
Debug i
Next ; i is optional
For i% = 0 to 10 Step 2
Print i%
Next 'To be more explicit use "Next i%"
For i% = 10 to 0 Step -2
Print i%
Next i
FOR i = 1 TO 21 STEP 2
PRINT i;
NEXT i
10 FOR I = 1 TO 21 STEP 2
20 PRINT I; " ";
30 NEXT I
for i = 2 to 8 step 2
print i; ", ";
next i
print "who do we appreciate?"
FOR n = 2 TO 8 STEP 2
PRINT n & "..";
NEXT n
PRINT "who do we appreciate?"
END
:For(I,0,100,5
:Disp I
:End
Local i
For i, 0, 100, 5
Disp i
EndFor
REM TinyBasic does not have a for-loop construct.
REM Equivalent using conditional jump:
LET i = 1
10 IF i > 21 THEN GOTO 20
PRINT i
LET i = i + 2
GOTO 10
20 END
FOR i = 1 TO 21 STEP 2
PRINT i; " ";
NEXT i
END
FOR i = 1 TO 5 STEP .5
PRINT i
NEXT i
END
Sub MyLoop()
For i = 2 To 8 Step 2
Debug.Print i;
Next i
Debug.Print
End Sub
Imports System.Console
Module Program
Sub Main()
For i = 2 To 8 Step 2
Write($"{i}, ")
Next
WriteLine("who do we appreciate?")
End Sub
End Module
Public Class FormPG
Private Sub FormPG_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim i As Integer, buffer As String
buffer = ""
For i = 2 To 8 Step 2
buffer = buffer & i & " "
Next i
Debug.Print(buffer)
End Sub
End Class
PROGRAM "forby"
DECLARE FUNCTION Entry()
FUNCTION Entry()
FOR i% = 0 TO 100 STEP 2
PRINT FORMAT$("###", i%)
NEXT i%
END FUNCTION
END PROGRAM
for i = 1 to 21 step 2
print i, " ";
next i
print
end
10 FOR l = 2 TO 8 STEP 2
20 PRINT l; ", ";
30 NEXT l
40 PRINT "Who do we appreciate?"
You may also check:How to resolve the algorithm Euclid-Mullin sequence step by step in the Maxima programming language
You may also check:How to resolve the algorithm Arithmetic derivative step by step in the jq programming language
You may also check:How to resolve the algorithm Create a two-dimensional array at runtime step by step in the C++ programming language
You may also check:How to resolve the algorithm Logical operations step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Monads/Writer monad step by step in the Phix programming language