Hey,
Please i need help with prime numbers... i have been cracking my brain for the problem since two days ago..... I used this test code but there is a problem with it

for( number=3; number<=1000; count++){//to test number 3 to 1000
if(number%2 != 0){//to skip even numbers
for(int count=2; count<=number; count++){//the divider to make   
//sure no perfect divider except number itself
 
if((number%count != 0) && (count == number)){//condition for prime
cout<<number<<" ";
}
}
}
}

in the line

if((number%count !=0) &&(count==number))

for example 5 is prime, but when the count gets to 5, the first condition becomes false, hence the whole block skipped....

i have been thinking but didnt know which direction to think.....

any help?:(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.