Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In C language, if the integer 1 is divisible by an expression, why must it be changed to 1.0?
In C language, if the integer 1 is divisible by an expression, why must it be changed to 1.0?
Internet is used for plastic surgery. During division, the result of data division of type int has no decimal places, that is, 1/2 will only be equal to 0 instead of 0.5. If it is changed to 1.0, the computer will handle it according to the floating-point type, which is the reason.