How to make the division of 2 ints produce a float instead of another int?
Just cast one of the two operands to a float first. The cast has higher precedence than the division, so happens before the division. The other operand will be effectively automatically cast to a float by the compiler because the rules say that if either operand is of floating point type then the operation will … Read more