Login Register






Help Me Out .[MATHEMATICS] filter_list
Author
Message
RE: Help Me Out .[MATHEMATICS] #4
Here is some quick VB code to do it. Smile

[Image: 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]
Redcat Revolution!

Reply





Messages In This Thread
Help Me Out .[MATHEMATICS] - by Dead_Punisher - 05-29-2012, 02:42 AM