Sample
CODE
Option Explicit
Private Sub cmdClear_Click()
Cls
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdTryIt_Click()
Dim lngFactorial As Long
Dim intInputNbr As Integer
Dim intLoopCtr As Integer
intInputNbr = Val(InputBox("Enter a number:", "For/Next Loop"))
lngFactorial = 1
For intLoopCtr = 1 To intInputNbr
lngFactorial = lngFactorial * intLoopCtr
Next
Print CStr(intInputNbr); "! = "; lngFactorial
End Sub
ExplanationRepetition is also known as the looping or iteration control structure. Looping is the process of repeatedly executing one or more steps of an algorithm or program; it is essential in programming, as most programs perform repetitious tasks.


No comments:
Post a Comment