Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Private Sub cmdClear_Click() Private Sub Command1_Click()

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

Else if num = num - 1


n = Val(Text1.Text)
For i = 1 To n Wend
f=f*i
MsgBox "Factorial number is : " & ans
Next
MsgBox “Factorial is :” & f, vbInformation, End if
“Factorail”
End Sub
End if
End Sub

Private Sub Form_Activate()


Text1.SetFocus
End Sub

_____________________________

You might also like