5.编写程序,设a=2,b=3,x=3.5,y=2.5计算并输出算术表达式(float)(a+b)/2+(int)x%(4. 编写程序,设x=2.5,a=7,y=4.7计算并输出算术表达式x+a%3*(x+y)%2/4的值.
问题描述:
5.编写程序,设a=2,b=3,x=3.5,y=2.5计算并输出算术表达式(float)(a+b)/2+(int)x%(
4. 编写程序,设x=2.5,a=7,y=4.7计算并输出算术表达式x+a%3*(x+y)%2/4的值.
答
#include
main() {
float x = 2.5,a = 7,y = 4.7;
printf("%f",x + a%3*(x+y)%2/4);
}
#include
main() {
int a =2,b=3;
float x=3.5,y=2.5;
printf("%f",(float)(a+b)/2 + (int)x%y);
}