c语言答案-贾宗璞 许合利,C语言习题答案贾宗璞许合利较全-.doc-资源下载在线文库www.lddoc.cn...
C語言習題答案 賈宗璞 許合利 較全-.doc
1參考答案習題一1、 選擇題CBACD2、 填空題1) main2) main3) 有窮性、確定性、有效性、0 個到多個輸入、1 個到多個輸出4) 順序、選擇、循環5) 自頂向下、逐步細化、模塊化設計、限制 goto習題二1、 選擇題ACCDA DDAAC BBACC2、 填空題1) 字母、數字、下劃線2) 03) 4 84) a b * c / a c 5) -606) -167) 98) 6 4 29) 010) 10 611) 12 412) 3.50000013) 014) 1615) 6.63、編程題(1)編寫一個程序求各種類型數據的存儲長度。include void mainprintf“intd byten“,sizeofint;printf“short intd byten“,sizeofshort int;printf“long intd byten“,sizeoflong int;printf“floatd byten“,sizeoffloat;printf“doubled byten“,sizeofdouble;printf“long doubled byten“,sizeoflong double;printf“chard byten“,sizeofchar;2include define RAT 1.60934void mainfloat k;printf“ the km“;scanf“f“,printf“milefn“,k/RAT;習題三1、 選擇題DACDD DCDCC2、 解析題1)include void main int x170;float a513.789215;printf“x3d,x6d,x6o,x6x,x6un“,x,x,x,x,x;printf“x-3d,x-6d,x6d,x6dn“,x,x,x,x;printf“a8.6f,a8.2f,a14.8f,a14.8lfn“,a,a,a,a;結果x170,x 170,x 252,x aa,x 170 x170,x170 ,x 170,x6da513.789185,a 513.79,a 513.78918457,a 513.789184572)include main int a,b;float x,y;char c1,c2;scanf“ad bd“,scanf“xf yf“,scanf“c1c c2c“,printf“ad,bd,xf,yf,c1c,c2c“,a,b,x,y,c1,c2;正確輸入格式A3 b7x8.5 y71.82c1A c2a3、 編程題1)include void main3int x,y;scanf“dd“,printf“商數d,余數d“,x/y,xy; 2)include void maindouble x,y,z,avg;scanf“lflflf“,avgxyz/3;printf“.1f“,avg;習題四1、 選擇題CCAAD CCABD2、 填空題1 a0printf“please a number“;scanf“d“,ifx20 printf“x is a even number“;else printf“x is a odd number“;2include 4mainint x,y;printf“please a number“;scanf“d“,ifx-5 printf“please a number“;scanf“d“,switcha/10 case 0case 1case 2m1;break;case 3m2;break;case 4m3;break;case 5m4;break;defaultm5;break;printf“d“,m;4include mainfloat price,tax;printf“please the price of product“;scanf“f“,ifprice10000 taxprice*0.05;else ifprice5000 taxprice*0.03;else ifprice1000 taxprice*0.02;else tax0;printf“f“,tax;5include main5float score;printf“please the score of student“;scanf“f“,ifscore85 printf“VERY GOOD“;else ifscore60 printf“GOOD“;else printf“BAD“;6include main int x,y,z;printf“ two number“;scanf“dd“,ifx99 y99printf“ data errorn“;else zx/10*1000y/10*100x10*10y10; printf“dn“,z;習題五1、 選擇題DCADA DDBDB CADAC2、 填空題1 fahr celsius5.0/9*fahr-32; fahrstep;2 i5 j4 k63 3*i-24 y z*x 5 8 5 26 j ij0 ji 7 summain int n,k;float score,sum,ave;/found/forn1;nmain int i,j,k,m;fori1; imaindouble r,eps,temp;int m1;printf“nPlease enter a precision “;scanf“lf“,r0.0;/*found*/temp1;/found/whiletemp epsrtemp;temptemp*m/2*m1;m;/found/printf“nepslf,Pilfnn“,eps,r*2;4)include 7main int m0,mix0,n;/found/scanf“d“,whilen2 int n0,max0,t;scanf“d“,do/*found/tm10;/*found/ift0 n;ifmaxmainint s;float n,t,sum;t1; sum0; n1; s1.0;whilenmainint i;long int n1;fori1;imainint n,i,j;scanf“d“,fori1;imainint m,s,i;form2;mmain int h10,h7,h5;forh100; h10main int day,x1,x2; day9; x21; whileday0 x1x21*2; 第一天的桃子數是第 2 天桃子數加 1 后的 2 倍 x2x1; day; printf“the total is dn“,x1; 7)include includemain float x,x0,f,f1; x1.5; 可改為 scanf“f“,do x0x; f2*x0*x0*x0-4*x0*x03*x0-6; f16*x0*x0-8*x03; f 的導數,即它的切線 xx0-f/f1; 切線與 x 軸的交點 whilefabsx-x01e-5; printf“The root is 8.7fn“,x; 108)include main int p,r,n,m,temp;printf“ two integer n,m“;scanf“d,d“,ifnnpn*m; whilem0 rnm;nm;mr;printf“greatest common divisor isdn“,n; 最大公約數printf“lease common multiple isdn“,p/n; 最小公倍數1112131415161718192021222324252627282930
總結
以上是生活随笔為你收集整理的c语言答案-贾宗璞 许合利,C语言习题答案贾宗璞许合利较全-.doc-资源下载在线文库www.lddoc.cn...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 支持向量机SVM--线性
- 下一篇: c语言调用函数的方法案例,C语言经典例题