Option Explicit
Dim b As Double
Dim opt As String
Private Sub Command1_Click()
Text1.Text = Text1.Text & 1
End Sub
Private Sub Command10_Click()
Text1.Text = Text1.Text & 0
End Sub
Private Sub Command11_Click()
Text1.Text = Text1.Text & "."
End Sub
Private Sub Command12_Click()
b = Val(Text1.Text)
If opt = "add" Then
Text1.Text = a + b
End If
If opt = "sub" Then
Text1.Text = a - b
End If
If opt = "mult" Then
Text1.Text = a * b
End If
End Sub
Private Sub Command13_Click()
Text1.Text = Text1.Text & "+"
opt = "add"
a = Val(Text1.Text
Text1.Text = Clear
End Sub
Private Sub Command14_Click()
Text1.Text = Text1.Text & "-"
opt = "sub"
a = Val(Text1.Text)
Text1.Text = Clear
End Sub
Private Sub Command15_Click()
Text1.Text = Text1.Text & "*"
opt = "mult"
a = Val(Text1.Text)
Text1.Text = Clear
End Sub
Private Sub Command16_Click()
If (Text1.Text Mod 2 = 0) Then
MsgBox (" Number is even:- " & " " & Text1.Text)
Else
MsgBox (" Number is odd:- " & " " & Text1.Text)
End If
End Sub
Private Sub Command17_Click()
Dim fact, i As Integer
fact = 1
For i = 1 To Text1.Text
fact = fact * i
Next
Text1.Text = ("Factorial number is:- " & " " & fact)
End Sub
Private Sub Command18_Click()
Dim s As Integer
For i = 2 To Text1.Text - 1
If (Text1.Text Mod 2 = 1) Then
s = 1
Else
s = 0
End If
Next
If (s = 1) Then
Text1.Text = ("number is prime:- " & " " & Text1.Text)
Else
Text1.Text = ("number is not prime:- " & " " & Text1.Text)
End If
End Sub
Private Sub Command19_Click()
Text1.Text = " "
End Sub
Private Sub Command2_Click()
Text1.Text = Text1.Text & 2
End Sub
Private Sub Command3_Click()
Text1.Text = Text1.Text & 3
End Sub
Private Sub Command4_Click()
Text1.Text = Text1.Text & 4
End Sub
Private Sub Command5_Click()
Text1.Text = Text1.Text & 5
End Sub
Private Sub Command6_Click()
Text1.Text = Text1.Text & 6
End Sub
Private Sub Command7_Click()
Text1.Text = Text1.Text & 7
End Sub
Private Sub Command8_Click()
Text1.Text = Text1.Text & 8
End Sub
Private Sub Command9_Click()
Text1.Text = Text1.Text & 9
End Sub