Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim I, N As Integer
N = CInt(TextBox1.Text)
For I = 2 To N - 1
If N Mod I = 0 Then
Label2.Text = "THE NUMBER IS NOT A PRIME NUMBER"
Exit Sub
End If
Next I
Label2.Text = "THE NUMBER IS A PRIME NUMBER"
End Sub
End Class
No comments:
Post a Comment