C语言程序设计课后答案罗朝盛【参考】.docVIP

  • 28
  • 0
  • 约2.97万字
  • 约 39页
  • 2017-01-04 发布于浙江
  • 举报

C语言程序设计课后答案罗朝盛【参考】.doc

第1章 习题参考答案 1. (略) 判断题 1 2 3 4 5 √ × √ × √ 填空题 main 函数的首部、函数体 {、} main、main 语句、分号(;) 选择题 1 2 3 4 5 C C C A B 选择题 #include stdio.h main() { int a, b, s; float t; printf(Enter A,B=?\n); scanf(%d%d, a, b); s=a+b; t=a*b; printf(s=%d, t=%f\n, s, t); } #include stdio.h main() { printf(=================\n); printf( Hello! \n); printf( How do you do \n); printf(=================\n); } (3) #include stdio.h main() { int r, h; float v; printf(Enter R, H=?\n); scanf(%d%d, r, h); v=3.1415926*r*r*h; printf(v=%f\n,v); } 第2章 习题参考答案 一.(略) 二.填空题 2.5 16 10 16、16、11 4、10、6 18、3、3 sin(65*3.14/180)+2*(3.1415926 +exp(y))/(x-y) 25、25 27 4 0 选择题 1 2 3 4 5 6 7 8 9 10 11 12 D D C B D A D B C D A B 四、编程题 1. #include stdio.h main() { int x, a, b, c; printf(Enter a intger number x=?\n); scanf(%d,x); a=x /100; b=x%100/10; c=x%10; printf(%d %d %d\n, a, b, c); } 2. #include stdio.h main() { unsigned a, b,r1,r2,r3; scanf(%u%u, a, b); r1=a b; r2=a|b; r3=a^b; printf(r1=%u,r2=%u,r3=%u\n,r1,r2,r3); getch(); } 3. #include stdio.h main() { float a, b, h, s; scanf(%f%f?%f, a, b, h); s=(a+b)*h/2; printf(s=%f\n, s); } 第3章 习题参考答案 一、判断题 1 2 3 4 5 6 × × × √ √ × 填空题 语句 表达式语句 { } 函数 由“%”和格式字符 getchar() 27 ,33 ,1b x(1)=23.14 x(2)=-78.32 5+ 6 程序阅读题 1、 p=3.14 p=3.1416 p= 3.14 p= 3.1416 p=3.14 p=3.1416 2、 a----ASCII: 97 a----ASCII: 97 a----ASCII: 97 编程题 1、 #include stdio.h main() { int a, b; float r1, r2; scanf(%d%d, a, b); r2=a+b; r1=a*b/r2; printf(r1=%0.2f,r2=%0.2f\n, r1, r2); } 2、 #include stdio.h main() { float c, f; printf(Input C=); scanf(%f, c); f=9.0/5*c+32; printf(F=%f\n, f); } 3、 #include stdio.h void main() { float c1, c2, c3, ver, s; printf(Input a, b and c:); scanf(%f%f%f, c1, c2, c3); s=c1+c2+c3; ver=s/3; printf(total s=%f , ver=%f\n, s,ver); } } 第4章 习题参考答案 判断题 1 2 3 4 5 6 × × √ √ × √ 选择题 1 2 3 4 5 6 7 8 B B B B D A B B 程序阅读题

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档