different results on execution

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

I made a new Xcode 4 project and replaced what was in main.m with your code, and it worked perfectly. I ran it 20 times, and it always went to 97.

Ric

thanks.
If I wait for few seconds before running the program again, it seems to work correctly.