12-07-2011, 01:02 PM
(This post was last modified: 12-07-2011, 01:08 PM by ravi.gajul.)
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