prime numbers

hi guys, can any body give some simple codes about printing a series of prime number in any limit of integer? thanks....ASAP...
I don't think anyone is going to post the solution to your homework, but if you posted up some code you've tried and you are having a problem, then I'm sure someone would help.
int is_prime(int n) {
if (n == 1) return 0; // 1 is NOT a prime
if (n == 2) return 1; // 2 is a prime
if (n%2 == 0) return 0; // NO prime is EVEN, except 2
for (int i=3; i*i<=n; i+=2) // start from 3, jump 2 numbers
if (n%i == 0) // no need to check even numbers
return 0;
return 1;
}
thanks i get it,,,,

more power,
jho
Topic archived. No new replies allowed.