I am trying to get a VB program that will determine whether or not a user-generated number is prime or not. Right now, all I have is this:
It's just getting the factors of a number. I cannot get it to tell prime numbers apart, however. Any help?
Code:
Dim num As Integer
Dim factor As Integer
factor = 1
num = TextBox1.Text
Do While num >= factor
If num Mod factor = 0 Then
RichTextBox1.AppendText(vbCrLf & factor)
End If
factor = factor + 1
Loop
It's just getting the factors of a number. I cannot get it to tell prime numbers apart, however. Any help?