若有定义“int a=7;float x=2.5,y=4.7;”,则表达式x+a%3*(int)(x+y)%2/4的值是多

问题描述:

若有定义“int a=7;float x=2.5,y=4.7;”,则表达式x+a%3*(int)(x+y)%2/4的值是多

按如下顺序运算:
(x+y) = 7.2
(int)(x+Y) = 7
a%3 = 1
a%3*(int)(x+y)%2/4 = 1*7%2/4 = 7%2/4 = 1/4 = 0(注意,所有变量均是Int型)
x+0 = 2.5
所以答案是2.5