RE: Help Me Out .[MATHEMATICS] 05-29-2012, 05:31 AM
#4
Here is some quick VB code to do it. 
![[Image: 7hh0N.png]](http://i.imgur.com/7hh0N.png)

![[Image: 7hh0N.png]](http://i.imgur.com/7hh0N.png)
Code:
Private Sub btnMain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMain.Click
listMain.Items.Clear()
Dim IsPrime As Boolean
For pNum As Integer = 2 To numLimit.Value
IsPrime = True
If pNum = 2 Then GoTo Except
If Not pNum Mod 2 = 0 Then
Except:
For F As Integer = 2 To numLimit.Value - 1
If pNum Mod F = 0 Then
If Not F = pNum Then IsPrime = False
Exit For
End If
Next
If IsPrime = True Then
With listMain.Items
.Add(.Count + 1)
.Item(.Count - 1).SubItems.Add(pNum)
.Item(.Count - 1).SubItems.Add(pNum ^ 0.5) 'Square root
End With
End If
End If
Next
End Sub![[Image: rytwG00.png]](http://i.imgur.com/rytwG00.png)
Redcat Revolution!





![[+]](https://sinister.li/images/modern/collapse_collapsed.png)