Monday, 4 April 2016

Lab 8:Write a Visual Basic Program to Find Prime or Not

Private Sub Command1_Click()
Dim i As Integer
Dim n As Integer
n = Val(Text1.Text)
For i = 2 To n - 1
If n Mod i = 0 Then
Print "it is not a prime no"
Exit Sub
End If
Next i
Print "it is  a prime no"

End Sub

No comments:

Post a Comment