首页 C语言程序设计课后答案_罗朝盛

C语言程序设计课后答案_罗朝盛

举报
开通vip

C语言程序设计课后答案_罗朝盛第1章 习题参考答案 1. (略) 2 判断题 1 2 3 4 5 √ × √ × √           3 填空题 (1) main (2) 函数的首部、函数体 (3) {、} (4) main、main (5) 语句、分号(;) 4 选择题 1 2 3 4 5 C C C A B           5 选择题 (1) #include main() { int a, b, s; float t; printf("Enter  ...

C语言程序设计课后答案_罗朝盛
第1章 习 快递公司问题件快递公司问题件货款处理关于圆的周长面积重点题型关于解方程组的题及答案关于南海问题 参考 答案 八年级地理上册填图题岩土工程勘察试题省略号的作用及举例应急救援安全知识车间5s试题及答案 1. (略) 2 判断题 1 2 3 4 5 √ × √ × √           3 填空题 (1) main (2) 函数 excel方差函数excelsd函数已知函数     2 f x m x mx m      2 1 4 2拉格朗日函数pdf函数公式下载 的首部、函数体 (3) {、} (4) main、main (5) 语句、分号(;) 4 选择题 1 2 3 4 5 C C C A B           5 选择题 (1) #include 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); } (2) #include main() { printf("=================\n"); printf("  Hello! \n"); printf("  How do you do \n"); printf("=================\n"); } (3) #include 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章 习题参考答案 一.(略) 二.填空题 (1) (2) 2.5 (3) 16 (4) 10 (5) 16、16、11 (6) 4、10、6 (7) 18、3、3 (8) sin(65*3.14/180)+2*(3.1415926 +exp(y))/(x-y) (9) 25、25 (10) 27 (11) 4 (12) 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 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 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 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 × × × √ √ ×             2 填空题 3 语句 4 表达式语句 5 {  } 6 函数 7 由“%”和格式字符 8 & 9 getchar() 10 27    ,33    ,1b 11 x(1)=23.14      x(2)=-78.32  12 5+ 6 3 程序阅读题 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 4 编程题 1、 #include 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 main() { float c, f; printf("Input C="); scanf("%f", &c); f=9.0/5*c+32; printf("F=%f\n", f); } 3、 #include 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 判断题 1 2 3 4 5 6 × × √ √ × √             2 选择题 1 2 3 4 5 6 7 8 B B B B D A B B                 3 程序阅读题 (1) 105 (2) a=8 (3) abc123DEF (4) 4 程序填空题 (1) ch            ch==')'        count--        count==0            count>0 (2) div=n        div— (3) min=mark    min=mark      max=mark      sum+=mark 5 编程题 (1) #include void main( ) { int x,y; printf("Enter the X,Y=?\n"); scanf("%d,%d",&x,&y); if(x>0 && y>0) printf("(%d,%d)是第一像限\n",x,y); else if(x>0 && y<0) printf("(%d,%d)是第四像限\n",x,y); else if(x<0 && y>0) printf("(%d,%d)是第三像限\n",x,y); else if(x<0 && y<0) printf("(%d,%d)是第二像限\n",x,y); else if(x>0 && y==0) printf("(%d,%d)在X轴正方向\n",x,y); else if(x<0 && y==0) printf("(%d,%d)在X轴负方向\n",x,y); else if(x==0 && y>0) printf("(%d,%d)在Y轴正方向\n",x,y); else if(x==0 && y<0) printf("(%d,%d)在Y轴负方向\n",x,y); else printf("(%d,%d)为坐标原点\n",x,y); } (2) #include #include main() { float a, b, c, x, s; printf("Input a, b and c:"); scanf("%f%f%f", &a, &b, &c); if(a+b<=c || a+c<=b || b+c<=a) printf("Error!\n"); else{ x=(a+b+c)/2; s=sqrt(x*(x-a)*(x-b)*(x-c)); printf("area=%f\n", s); } } (3) 程序代码如下: #include void main() { float salary, tax; int ntax; printf("\nPlease enter a salary="); scanf("%f",&salary); ntax=salary/500; if (ntax>=10) ntax=10; switch(ntax) { case 0: case 1: tax=0;break; case 2: tax=(salary-1000)*0.05;break; case 3:case 4: tax=500*0.05+(salary-1500)*0.1;break; case 5:case 6: tax=500*0.05+1000*0.1+(salary-2500)*0.15;break; case 7:case 8:case 9: tax=500*0.05+1000*0.1+1000*0.15+(salary-3500)*0.20;break; case 10: tax=500*0.05+1000*0.1+1000*0.15+1500*0.20+(salary-5000)*0.30; } printf("\nThe tax=%10.2f\n",tax); } (4) 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 一 #include #include main() { int i=1; float t=-1, s=0; do{ t= -t/i; s=s+t; i=i+1; }while(fabs(t)>1e-6); printf("s=%f\n", s); } 方法二 #include void main() { int i=1,sign=1; float t=1.0, s=0.0; while(1.0/t>1e-6) { t= t*i; s=s+sign/t; i=i+1; sign=-sign; }; printf("s=%f\n", s); } (5)方法一: #include main() { int i, a, b, c; for(i=100; i<=999; i++) { a=i /100; b=i/10%10; c=i%10; if(i==a*a*a+b*b*b+c*c*c) printf("%d\n", i); } } 方法二: #include void main() { int i, a, b, c; for(a=1; a<=9; a++)
本文档为【C语言程序设计课后答案_罗朝盛】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_037433
暂无简介~
格式:doc
大小:52KB
软件:Word
页数:18
分类:计算机考试
上传时间:2019-04-19
浏览量:102