i was given a assignment to release the first n prime numbers
it turned out to be alright for the first 8 prime number by showing 8 prime numbers. but when i tried 9, it gave me 7 prime numbers instead with a missing of 3 as a prime number. i can't figure out what's wrong with my programming. can anyone there help me please! thanks a lot
while (count <= n); //because count is initialized to 1 (not 0) ;)
Another point
- div should be initialized to 3, coz you're incrementing number by 2, so you're sure that even numbers are not going to be in the picture at all. No point "moduling" by 2.