Hi all, I have a project for varsity where I have to find all the prime numbers in an array of 1000 int's. The question is actually about threads, start 10 threads each checking 100 ints each for 'primeness'. I have the threads running and thats working fine, my problem is, how do i check for prime now?
The question says I must do this:
Hint:To check a number p for primality, use a loop-structure running
from 2 (not 1!) to p/2. Divide p by the loop index; if the remainder is 0,
then you have found a factor of p, and hence p is not prime.
I get:
Can anyone help with a loop to work out if a number is prime or not.
I have included all my code, maybe there is a better way to do it.
Thamks
alot Ian