if condition fail

The if statement is not failing. It is doing exactly what you programmed.

Take out the if statement and see what is printed. Then you will see why you have a series of 3s.

hint: when does the count stop incrementing? what happens if/when it reaches its maximum value?