Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Divide by shaping to get floating point.
Divide by shaping to get floating point.
Both A and B are plastic, and of course the value of a+b is also plastic. (float)(a+b) is to convert the value of a+b into a floating-point type.

(float)(a+b)/2 Floating-point types are divided by shaping, including implicit type conversion, which is upward conversion. When plastic and floating-point operations are performed, plastic should be automatically converted into floating-point operations, and the result is floating-point.

int a=2,b = 3; (floating point) (a+b)/2=2.5