《第4章C语言程序设计(张曙光)教材各章习题解答》.docVIP

  • 8
  • 0
  • 约9.29千字
  • 约 9页
  • 2019-12-22 发布于天津
  • 举报

《第4章C语言程序设计(张曙光)教材各章习题解答》.doc

1. (1)(ch=a ch=z) (2)a%2==1 (3)a=1 a=8 a!=7 (4)10 (5)x%3==0 x%5==0 (6)do-while (7)零次 (8)continue (9)break (10)-100 2. (1)D) (2)B) (3)C) (4)D) (5)C) 3. (1)① getchar() ② a=’u’ ③ c=c+5 ④ c=c-21 (2)⑤ b=i+1 ⑥ c-11 (3)⑦ i%3==2 i%5==3 i%7==2 ⑧ j%5==0 4. (1) else if(x5.0)后面的;是错误的。 (2)s要赋初值0,循环体中要增加x++; (3)} while(n)后面差;。 (4) int i,t=1,s=0; for(i=1;i=101;i+=2)后面的;是错误的。循环体中应该执行3条语句,所以要用{}括起来。 (5)循环变量最好不要为浮点类型。 5. (1)0.5000000 (2)3 (3)9 8 7 (4)y=6 6. #include stdio.h #includemath.h int main(void) { float a,b,c,p,disc,q,x1,x2; scanf(%f%f%f,a,b,c); p=-b/(2*a); disc=b*b-4*a

文档评论(0)

1亿VIP精品文档

相关文档