Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - There is an integer variable x, a single-precision variable y=5.5, the expression x=(float)(y*3+((int)y)%4), and the value of x is ().
There is an integer variable x, a single-precision variable y=5.5, the expression x=(float)(y*3+((int)y)%4), and the value of x is ().
First, the type conversion is forced. When y is converted into int, it is an integer operation, that is, the decimal part is discarded, so 5 is obtained.

5%4= 1, that is, the remainder of 5 divided by 4 is 1.

y*3=5.5*3= 16.5

16.5+ 1= 17.5

Because X is an integer variable, it contains an implicit type conversion, that is, rounding, discarding the decimal part, that is, 17, and assigning it to X, the result is x= 17.