
帮忙做几个C语言的题啊,感激不尽!
8.设a=13,n=7,计算下面表达式的值(1)a+=3*a(2)a-=2(3)a*=10-3(4)a/=(a+a)/2(5)a%=(n%=2)(6)a+=a-=a*=a...
8. 设a=13,n=7,计算下面表达式的值
(1)a+=3*a
(2) a-=2
(3) a*=10-3
(4) a/=(a+a)/2
(5) a%=(n%=2)
(6) a+=a-=a*=a
9. 指出下列程序中的错误之处
#define tax of rate 0.08;
main()
{float cost;total;
printf(“Enter the cost of the item:")
scanf("%f",cost);
printf("Enter the shipping charge:");
scanf("%f/n",&shipping)
total=cost+cost*tax of rate + shipping;
printf("the total is &f:",total);
5. 编一程序,从键盘输入一个5位正整数,然后分别求出它的个位数,十位数,百位数,千位数和万位数,并打印出这五位数字的和。如输入12345,打印出15(1+2+3+4+5=15)
6. 求下面算术表达式的值:
(1) x+a%3*(int)(x+y)%2/4-6,设x=2.8,a=7,y=4.6
(2) (double)(a+b)/3+(int)x%(int)y,设a+8,b=2,x=13.5,y=10.5
7. 写出程序运行结果
main()
{
int i,j,m,n;
i=11;
j=10;
m=2*--i;
n=j--;
printf("%d,%d,%d,%d',i,j,m,n);
} 展开
(1)a+=3*a
(2) a-=2
(3) a*=10-3
(4) a/=(a+a)/2
(5) a%=(n%=2)
(6) a+=a-=a*=a
9. 指出下列程序中的错误之处
#define tax of rate 0.08;
main()
{float cost;total;
printf(“Enter the cost of the item:")
scanf("%f",cost);
printf("Enter the shipping charge:");
scanf("%f/n",&shipping)
total=cost+cost*tax of rate + shipping;
printf("the total is &f:",total);
5. 编一程序,从键盘输入一个5位正整数,然后分别求出它的个位数,十位数,百位数,千位数和万位数,并打印出这五位数字的和。如输入12345,打印出15(1+2+3+4+5=15)
6. 求下面算术表达式的值:
(1) x+a%3*(int)(x+y)%2/4-6,设x=2.8,a=7,y=4.6
(2) (double)(a+b)/3+(int)x%(int)y,设a+8,b=2,x=13.5,y=10.5
7. 写出程序运行结果
main()
{
int i,j,m,n;
i=11;
j=10;
m=2*--i;
n=j--;
printf("%d,%d,%d,%d',i,j,m,n);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询