Unless you WANT the first prime number after 100 to be in the loop, it makes no sense. I'll take that back if that's what you wanted to achieve.
Otherwise, I'd seek the fault in your isPrime function. It might always return false. Also, I hope you defined total and lastPrime(especially lastPrime. There's a high chance that lastPrime is larger than 100 if you declared it without defining it).