Your program is correct. Its running and stopping after 20 times. The output is always 0 as you are matching a double value with integer value which will never be true.

So you change your code as...