i'm not looking for someone to explicitly answer this but a few hints would be great. i'm trying to write a couple of functions for determining prime numbers. the first asks for the user to enter an integer which is passed to a function with a return value indicating whether the integer is a prime or not. before i pass the integer i determine if it's even using i%2 approach. if it is even (except 2) i don't send it, i just cout that it's not a prime.
once the int is passed to the function it's assumed to be odd and cannot be divided by an even number so i set up a for loop to modulus by only odd numbers 3,5,7 and 9 with 0 remainder returning to the calling function that the number is not prime.
second is an algorithm to calculate all primes between 2 and 10000.
my problem is that i get on occasion in the list of primes a few that are not primes.
can someone set me off in the right direction? thanks, mark