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

2024-12-04 04:01:43
推荐回答(1个)
回答1:

int a=7;
float x=2.5,y=4.7;

x+a%3*(int)(x+y)%2/4
=> 4.7 + 7 % 3 * (int) ( 2.5+4.7) % 2 / 4
=> 4.7 + 1 * (int) (7.2) % 2 / 4
=> 4.7 + 1 * 7 % 2 / 4
=>4.7 + 1 * 1 / 4
=>4.7 + 0
=>4.7
考查运算符以及类型转换。