Sample Visual Basic 6 Program for Factorial

Sample Visual Basic 6 Program for Factorial


Dim a As String
Dim total As String
Private Sub Command1_Click()
a = InputBox("Insert number:")
If a > 12 Or a < 0 Then
    MsgBox ("Insert a value between 0 and 12!")
ElseIf a = 0 Then
    MsgBox ("1")
    Exit Sub
Else
total = 0
Do While a >= 1
    If total = 0 Then
        total = a
        total = total * Val(a)
    End If
    a = a - 1
Loop
MsgBox (total)
End If
End Sub 


Sample Visual Basic 6 Program for Factorial

Share this

Related Posts

There was an error in this gadget