Can anyone help me getting started with a prime number algorithm? I am stuck at the modulus operator. Ok if I read in a number from a file and use it as a limit for a loop, how can I find all the prime numbers inbetween 2 and this limit?
I've tried doing
inFile >> inputNumber;
BOOL isPrime(int value)
for(counter = 2; counter <= value; counter++)
if((value % counter) == 0)
This obviously is not the correct method for doing this as 9, for example, will be declared a prime number when it isn't. Does anyone have any ideas?