That is integer division. The reason is that 30 and 40 are integer literals. If you want to do a floating-point divide, at least one of the values must be a floating-point type.
Any of these should work:
30.0 / 40.0
30 / 40.0
30.0 / 40
However, if the user enters these values, then the variable which receives the input must be of a suitable type (double or float) instead of int.