Actually its working, it just that you didn't noticed that it is working since you are using an int primitive type.
1 divided by i (which is integer) will make result equal to zero (without decimal...