You're using ints to do double calculations. With integers, 1/3 is 0. 1-0 is 1. 4 * 1 is 4, so you get 4.0.

To see this better, do it in a few steps:

int step1 = 1/3;...