What are you looking for:
float ans = ((float)i/3);
Otherwise, you take two integers and dividing them to find the number of integer times when the divisor goes to the dividend. (As already mentioned, int / int = int regardless of the type of destination. And for the compiler, “3” is a different integer (unless you specify it as 3.0f))
source
share