First off, I'm not sure if this is the right forum, please move it if it isn't. I am only just beginning with visual basic and I am trying to write a basic program to calculate the prime numbers from 1 to 100. This is what I have so far:
Can someone please help me make this work. Thanks.
VB.NET:
Dim flag As Integer
Dim ar(101) As Integer
For i = 1 To 100
flag = 0
For j = 2 To ar(i) / 2
If ar(i) Mod j = 0 Then
flag = 1
Exit For
End If
Next
If flag = 0 Then
ListBox1.Items.Add((i) & " is Prime")
End If
Next
Can someone please help me make this work. Thanks.