file.vb
Private Sub Command1_Click()
Dim no1 As Integer
Dim no2 As Integer
Dim i As Integer
Dim flag As Boolean
flag = False
no1 = Val(Text1.Text)
no2 = Val(Text2.Text)
If no1 > 10 And no2 < 100 Then
While no1 <= no2
For i = 2 To no1 2
If no1 Mod i = 0 Then
flag = True
End If
Next
If flag = True Then
MsgBox ("Either of the number is not prime")
End
Else
cnt = cnt + 1
no3 = no1
no1 = no1 + 2
flag = False
End If
If cnt = 2 Then
If no3 = no2 Then
MsgBox "No1 and no2 are twin primes"
Else
MsgBox "No1 and no2 are not twin primes"
End If
End
End If
Wend
End If
End Sub
Private Sub Text1_Click()
Text1.Text = ""
End Sub
Private Sub Text2_Click()
Text2.Text = ""
End Sub