c语言第二章课后习题答案

内容发布更新时间 : 2024/12/23 4:06:46星期一 下面是文章的全部内容请认真阅读。

}

scanf(\ /*注意:输入的两个字符之间要用逗号隔开*/ i= c1

printf(\

5. 用C赋值语句表示以下计算式:

1)Area=?r2+2?rh

2m1m2?g2)Torque=

m1?m2

3)Side=a2?b2?2abcos(x)

(velocity)24)Energy=mass[acceleration×height+]

2【参考答案】

1)Area=PI*r*r+2*PI*r*h

2)Torque=((2*m1*m2)/(m1+m2))*g 3)Side=sqrt(a*a+b*b-2*a*b*cos(x))

4)Energy=mass(acceleration*height+velocity*velocity/2) 转换成程序: #include \#define PI 3.1415926 void main() { float r,h,Area; printf(\ scanf(\ pirntf(\ scanf(\ Area=PI*r*r+2*PI*r*h; printf(\} 2)

#include \#define g 9.8 void main()

{ float m1,m2,Torque; printf(\

scanf(\ pirntf(\ scanf(\

Torque=((2*m1*m2)/(m1+m2))*g; printf(\} 3)

#include \#include \void main() { float a,b,c,Side; printf(\ scanf(\ printf(\ scanf(\ printf(\ scanf(\

Side=sqrt(a*a+b*b-2*a*b*cos(x)); printf(\} 4)

#include \void main()

{ float mass,acceleration,height,velocity; printf(\ scanf(\

printf(\ scanf(\ printf(\ scanf(\ printf(\ scanf(\

Energy=mass(acceleration*height+velocity*velocity/2); printf(\

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4 ceshi