Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prime number calculation
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Try this
Code:
Dim arr()
ReDim arr(4)
arr(0)=1
arr(1)=1
arr(2)=2
arr(3)=3
arr(4)=4
ReDim Preserve arr(7)
arr(5)=5
arr(6)=6
arr(7)=7
For i=0  to ubound(arr)
    For j=2 to ubound(arr)
        If arr(i)  mod j=0 Then
           If  arr(i) = j Then
                msgbox "Prime" & arr(i)
            
             Else
            msgbox "Not Prime" & arr(i)
            
            Exit for
                            End If
          End If
           Next
Next
Reply


Messages In This Thread
Prime number calculation - by aditya2304 - 12-07-2011, 12:19 AM
RE: Prime number calculation - by sshukla12 - 12-07-2011, 11:56 AM
RE: Prime number calculation - by ravi.gajul - 12-07-2011, 01:02 PM
RE: Prime number calculation - by aditya2304 - 12-13-2011, 09:22 PM
RE: Prime number calculation - by ravi.gajul - 12-13-2011, 10:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to count a repeated number in number in particular range gollsrin 1 3,585 04-28-2011, 11:41 AM
Last Post: Saket

Forum Jump:


Users browsing this thread: 3 Guest(s)