资源描述:
《c语言练习册答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、答案:作业一1.(1)0000000000101101(2)1000000000101101(3)1111111111010011(4)65491(5)0177723(6)0xFFD32.1011001003100xC83.110000110101000001415200xC3504.0000000000000000000000001011001002620xB2作业二一、选择题DC011950xff21‘a’‘a’-0.e5“123”‘xf1’_year_123ABCepiint_二、填空题1.字母或下划线字母、数字、下划线2._一对双引号___一对单引号_3.“
2、”4._ASCII_5._初始化_6.57.244818.floatf=2.8;9.longinta2,*q=&a2;10.ffd81作业三一、单选题CCDBD二、填空题1.242.2410600003.sqrt((sin(60*3.14/180)+1)*(sin(30*3.14/180)+1)/cos(x))4.fabs(1-pow(x,3.6))5.(exp(x)+exp(-x))/26.2.57.3.58.65496136550013作业四一、单选题ACDBBA二、填空题1.将x的值取出,加3后存回。2.#include3.9,54.4.4三、编程
3、题1.#include#include#definePI3.1415926voidmain(){floata,b,c,s,jiaodu;printf(“shuru2bianyujiajiao:”);scanf(“%f,%f,%f”,&a,&b,&jioadu);c=sqrt(a*a+b*b-2*a*b*cos(jiaodu*PI/180);s=a*b*sin(jiaodu*PI/180)/2;printf(“bianchangc=%f,mianjis=%f”,c,s);}2.#includevoidmain(){floa
4、ta;intb,c,d;printf(“shuruRMB(yuan):”);scanf(“%f”,&a);d=(int)(a*100)/5;c=(int)(a*100)%5/2;b=(int)(a*100)%5%2;printf(“yingbishuliangwei:%d”,b+c+d);}作业五一、填空题1.01非002.03.z>80&&(x==100&&y>80
5、
6、y==100&&x>80)二、按照输出格式写出以下程序的运行结果21.a=1,b=0,c=02.a=8,b=8,c=103.y=0.5000004.3三、编程题1.#include"stdio.h"mai
7、n(){charc;c=getchar();if(c=='k’
8、
9、c=='K')printf("KOREAWORLDCUP");elseif(c=='j'
10、
11、c=='J')printf("JAPANWORLDCUP");elseif(c=='c'
12、
13、c=='C')printf("BEIJINOLYMPICGAMES");elseprintf("%c",c);}#includevoidmain(){charc;c=getchar();switch(c){case‘k’:case‘K’:printf(“KOREAWORLDCUP”);break;case
14、‘j’:case‘J’:printf(“JAPANWORLDCUP”);break;case‘c’:case‘C’:printf(“BEIJINOLYMPICGAMES”);break;default:printf(“%c”,c);}}2.作业六一、单选题CACBBB二、填空题1.52.63.020三、判断题ÏÏPPPÏPÏPÏ四、按照输出格式写出以下程序的运行结果1.úú1úú2úú42.k=612.main(){inti,fz=2,fm=1;floats=2.0;for(i=2;i<=20;i++){fz=fz+fm;fm=fz-fm;s+=1.0*fz/
15、fm;}printf(“s=%ld”,s);}五、编程题1.main(){inti;longfact,s;for(i=2;i<=10;i++){fact=fact*(-1)*I;s=s+fact;}printf(“s=%ld”,s);}2.main(){inti,fz=2,fm=1,f;floats=2.0;for(i=2;i<=20;i++){f=fz;fz=fz+fm;fm=f;s+=1.0*fz/fm;}printf(“s=%ld”,s);}作业七一、判断题PÏPPÏ二、按照输出格式写出以下程序的运行结果1.üü7,üü