1个回答
展开全部
得3.5
按运算符优先级,求解步骤:
[1](x+y)=2.5+4.7=7.2
[2] (int)(x+y)=7
[3] a%3=7%3=1
[4] 1*7=7
[5] 7%2=1
[6] 1%4=1
[7] x+1 = 2.5+1 = 3.5
----
程序验证:
#include <stdio.h>
int main(){
float x=2.5,y=4.7;
int a=7;
float v;
v=x+a%3*(int)(x+y)%2%4;
printf("%f\n",v);
return 0;
}
输出:3.
按运算符优先级,求解步骤:
[1](x+y)=2.5+4.7=7.2
[2] (int)(x+y)=7
[3] a%3=7%3=1
[4] 1*7=7
[5] 7%2=1
[6] 1%4=1
[7] x+1 = 2.5+1 = 3.5
----
程序验证:
#include <stdio.h>
int main(){
float x=2.5,y=4.7;
int a=7;
float v;
v=x+a%3*(int)(x+y)%2%4;
printf("%f\n",v);
return 0;
}
输出:3.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询