若有定义语句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