Because the condition fails, it won't run into your if condition, and ans does NOT get re-assigned and therefore ans will remain 2 (which is what you initialized it with).
also: each iteration of your loop will add 3 to the first element of the array, so it'll go:
29, 32, 35, 38
FOREVER.
*but* you'll hit the maximum value for an integer, get wrap around, and then get a division by zero exception.
You should step through this in a debugger rather than theorizing about the process.
Thank you very much for this beautiful explanation. I really appreciate it
If you really appreciate it, you won't modify your posts so that others happening upon this thread won't have the context to decipher what went on here. Your last post in combination with the OP edit is essentially saying "In thanks for your help, I'm making this thread useless for anyone else."