![]() |
|
Help Me Out .[MATHEMATICS] - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: General (https://sinister.li/Forum-General) +--- Forum: The Lounge (https://sinister.li/Forum-The-Lounge) +--- Thread: Help Me Out .[MATHEMATICS] (/Thread-Help-Me-Out-MATHEMATICS) Pages:
1
2
|
Help Me Out .[MATHEMATICS] - Dead_Punisher - 05-29-2012 Please help me out here. Can you guys find the square root of the following numbers : 2 3 5 etc of prime numbers. RE: Help Me Out .[MATHEMATICS] - Twisted - 05-29-2012 cant you just google each number? RE: Help Me Out .[MATHEMATICS] - Dead_Punisher - 05-29-2012 Why You dont know the answer? RE: Help Me Out .[MATHEMATICS] - Coder-san - 05-29-2012 Here is some quick VB code to do it. ![]() ![]() 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 SubRE: Help Me Out .[MATHEMATICS] - Coder-san - 05-29-2012 Here is some quick VB code to do it. ![]() ![]() 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 SubRE: Help Me Out .[MATHEMATICS] - Jacob - 05-29-2012 (05-29-2012, 05:31 AM)Coder-san Wrote: Here is some quick VB code to do it. good work man! RE: Help Me Out .[MATHEMATICS] - Jacob - 05-29-2012 (05-29-2012, 05:31 AM)Coder-san Wrote: Here is some quick VB code to do it. good work man! RE: Help Me Out .[MATHEMATICS] - Twisted - 05-29-2012 (05-29-2012, 04:03 AM)Dead_Punisher Wrote: Why You dont know the answer? rofl dude i fail at anything mathematical RE: Help Me Out .[MATHEMATICS] - Nailo - 05-29-2012 you could just Google that it looks like algebra 1 RE: Help Me Out .[MATHEMATICS] - Dashing Dante - 05-29-2012 Here you go , just download and find it all out : Prime Squareroot Generator , coded in C by me
|