I am writing a program to get prime numbers from 1 to 100.

i get different output everytime i run this code in Xcode.

```
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
int main (int argc, const char * argv[])
{
int last, i, j;
bool isPrime;
printf("The prime numbers from 1 to 100 are as follows:\n2\n3\n");
i = 3;
do {
i +=2;
last = sqrt(i);
isPrime = true;
for (j = 3; (j <= last) && isPrime; j+=2) {
if ((i % j) == 0) {
isPrime = false;
}
}
if (isPrime)
printf("%d\n", i);
} while (i < 99) ;
return 0;
}
```

Sometimes, the numbers show all the way upto 97. At other times, they show up only upto 13 or 41

Kindly help.

I am using Xcode 4.1