When a floating-point type is divided by an integer type, the integer variable is first converted into a floating-point type, and then the division operation is performed, and the result is a floating-point type;
For similar problems, the radical approach is to thoroughly understand how the implicit type conversion of C is carried out, such as integer promotion and so on; But I don't remember it clearly, so I recommend reading the relevant chapters in C (A Refenrece Manual).
But programming should try to avoid similar operations;