Professional Documents
Culture Documents
Factorial Number in VB
Factorial Number in VB
Text1.Text = “”
Text1.SetFocus Dim num, ans As Integer
End Sub
num = Val(Text1.Text)
Private Sub cmdExit_Click()
if num<1 then
Unload Me
End Sub ans = 1
Private Sub cmdFact_Click() else if
Dim n, f, i As Integer
While (num > 0)
If n<1 then
f=1 ans = ans * num
_____________________________