CODEING:
Public Class Form1
Dim i As Integer = 2
Dim k As Integer = 0
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
While i <= NumericUpDown1.Value / 2 And k = 0
If NumericUpDown1.Value Mod i = 0 Then
k = 1
else
i += 1
End If
End While
If k = 0 Then
MsgBox(NumericUpDown1.Value & " is Prime Number")
Else
MsgBox(NumericUpDown1.Value & " is not Prime Number")
End If
End Sub
End Class
Dim i As Integer = 2
Dim k As Integer = 0
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
While i <= NumericUpDown1.Value / 2 And k = 0
If NumericUpDown1.Value Mod i = 0 Then
k = 1
else
i += 1
End If
End While
If k = 0 Then
MsgBox(NumericUpDown1.Value & " is Prime Number")
Else
MsgBox(NumericUpDown1.Value & " is not Prime Number")
End If
End Sub
End Class
Comments
Post a Comment