版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
C語言程序設(shè)計(jì)第三版譚浩強(qiáng)課后習(xí)題答案完整版(完整版)(文檔可以直接使用,也可根據(jù)實(shí)際需要修改使用,可編輯歡迎下載)
£±.5??2???±???àyìa£?±àD′£-??C3ìDò£?ê?3?ò???D??¢£oC語言程序設(shè)計(jì)第三版譚浩強(qiáng)課后習(xí)題答案完整版(完整版)(文檔可以直接使用,也可根據(jù)實(shí)際需要修改使用,可編輯歡迎下載)**************************VeryGood!**************************?a£omian(){printf("**************************");printf("\n");printf("VeryGood!\n");printf("\n");printf("**************************");}£±.6±àD′£-??3ìDò£?ê?è?a?¢b?¢cèy???μ£?ê?3????D×?′ó?μ?£?a£omian(){inta,b,c,max;printf("??ê?è?èy??êya,b,c:\n");scanf("%d,%d,%d",&a,&b,&c);max=a;if(max<b)max=b;if(max<c)max=c;printf("×?′óêy?a£o"%d",max);}μúèy??3.6D′3?ò???3ìDò??DDμ??á1??£main(){charc£±='a',c£2='b',c3='c',c4='\£±0£±',c5='\£±£±6';printf("a%cb%c\tc%c\tabc\n",c£±,c£2,c3);printf("\t\b%c%c",c4,c5);}?a£oaa¨ébb¨é¨é¨écc¨é¨é¨é¨é¨é¨éabcA¨éN3.7??òa??"China"ò?3é?ü??£?ò???1??éê?£oó??-à′×???oó??μ?μú4??×???′úì??-à′μ?×???£?àyè?£?×???"A"oó??μú4??×???ê?"E"£?"E"′úì?"A"?£òò′?£?"China"ó|ò??a"Glmre"?£??±à£-3ìDò£?ó??33??μμ?·?·¨ê1cl?¢c£2?¢c3?¢c4?¢c5????±?á?μ??μ·?±e?a£?'C'?¢'h'?¢'i'?¢'n'?¢'a'£??-1y????£?ê1c£±?¢c£2?¢c3?¢c4?¢c5·?±e±??a'G'?¢'l'?¢'m'?¢'r'?¢'e'£?2¢ê?3??£?a£o#include<stdio.h>main(){charc£±='C',c£2='h',c3='i',c4='n',c5='a';c£±+=4;c£2+=4;c3+=4;c4+=4;c5+=4;printf("?ü??ê?%c%c%c%c%c\n",c£±,c£2,c3,c4,c5);}??DD?á1?£o?ü??ê?Glmre3.9?ó??????ê?±í′?ê?μ??μ?££¨£±£?x+a%3*(int)(x+y)%£2/4éèx=£2.5,a=7,y=4.7£¨£2£?(float)(a+b)/£2+(int)x%(int)yéèa=£2,b=3,x=3.5,y=£2.5£¨£±£?£2.5£¨£2£?3.53.£±0D′3?3ìDò??DDμ??á1??£main(){inti,j,m,n;i=8;j=£±0;m=++i;n=j++;printf("%d,%d,%d,%d",i,j,m,n);}?a£o9£?£±£±£?9£?£±03.£±£2D′3?????±í′?ê?????oóa(chǎn)μ??μ£?éè?-à′a=£±£2?£éèaoín??ò??¨ò??a??Dí±?á??££¨£±£?a+=a£¨£2£?a-=£2£¨3£?a*=£2+3£¨4£?a/=a+a£¨5£?a%=(n%=£2)£?nμ??μμèóú5£¨6£?a+=a-=a*=a?a£o(£±)£24(£2)£±0(3)60(4)0(5)0(6)0μú????4£?4è?a=3£?b=4£?c=5£?x=£±.£2£?y=£2.4£?z=-3.6£?u=5£±£274£?n=£±£28765£?c£±='a'£?c£2='b'?£??μ?μ?ò???ê?3???ê?oí?á1?£???D′3?3ìDò£¨°üà¨?¨ò?±?á?ààDíoíéè??ê?3?£??£a=_3__b=_4__c=_5x=£±.£200000,y=£2.400000,z=-3.600000x+y=_3.600__y+z=-£±.£20__z+x=-£2.40c£±=¨@a¨@_or_97(ASCII)c£2=¨@b¨@_or_98(ASCII)main(){inta=3,b=4,c=5;longintu=5£±£274,n=£±£28765;floatx=£±.£2,y=£2.4,z=3.6;charc£±='a',c£2='b';printf("a=%£2db=%£2dc=%£2d\n",a,b,c);printf("x=%f,y=%f,z=%f\n",x,y,z);printf("x+y=%5.£2fy+z=%5.£2fz+x=%5.£2f\n",x+y,y+z,z+x);printf("u=%6ldn=%9ld\n",u,n);printf("%s%s%d%s\n","c£±='a'","or",c£±,"(ASCII)");printf("%s%s%d%s\n","c£2='a'","or",c£2,"(ASCII)");}4£?7ó?scanf????μ?oˉêyê?è?êy?Y£?ê1a=3£?b=7£?x=8.5£?y=7£±.8£2£?c£±=¨@A¨@£?c£2=¨@a¨@£??ê?ú?ü?ìé?è?o?ê?è?£?main(){inta£?b£?floatx£?y£?charc£±c£2£?scanf£¨"a=%d_b=%d"£?&a£?&b£?£?scanf£¨"_x=%f_y=%e",&x£?&y£?£?scanf£¨"_c£±=%c_c£2=%c"£?&c£±£?&c£2£?£?}a=3_b=7_x=8.5_y=7£±.8£2_c£±=A_c£2=a4£?8éè?2°???r=£±.5£??2?ù??h=3£??ó?2?ü3¤?¢?2???y?¢?2?ò±í???y?¢?2?òì??y?¢?2?ùì??y?£ó?scanfê?è?êy?Y£?ê?3??????á1?£?ê?3?ê±òa?ó??×??μ?÷£?è?D?êyμ?oóá???êy×??£??±à3ìDò?£main(){floatr,h,C£±,Sa,Sb,Va,Vb;scanf("%f,%f",&r,&h);C£±=£2*3.£±4*r;Sa=3.£±4*r*r;Sb=4*Sa;Va=4*3.£±4*r*r*r/3;Vb=Sa*h;printf("C£±=%.£2f\n",C£±);printf("Sa=%.£2f\nSb=%.£2f\nVa=%.£2f\nVb=%.£2f\n",Sa,Sb,Va,Vb);}4£?9ê?è?£-???aê????è£?òa?óê?3?é?ê????è?£1?ê??ac=5(F-3£2)/9ê?3?òa?óóD??×??μ?÷£?è???£2D?êy?£main(){floatF,c;scanf("%f",&F);c=5*(F-3£2)/9;printf("c=%.£2f",c);}4£?£±0±à3ìDò£?ó?getcharoˉêy?áè?á???×?·???c£±?¢c£2£?è?oó·?±eó?oˉêyoíoˉêyê?3??aá???×?·??£2¢????ò????êìa£o£¨£±£?±?á?c£±?¢c£2ó|?¨ò??a×?·?Dí?ò??D?£?ò??t?????é£?£¨£2£?òa?óê?3?c£±oíc£2?μμ?ASCII??£?ó|è?o?′|àí£?ó?putcharoˉêy?1ê?printfoˉêy£?£¨£3£???D?±?á?ó?×?·?±?á?ê?·??úè?o??é???????éò??¥?à′úì?£?è?£ochar??c£±£?c£2£?ó?int??c£±£?c£2£?ê?·??Tì??tμ?μè??£?#include"stdio.h"main(){charc£±,c£2;c£±=getchar();c£2=getchar();putchar(c£±);putchar('\n');putchar(c£2);putchar('\n');}#include"stdio.h"main(){charc£±,c£2;c£±=getchar();c£2=getchar();printf("c£±=%dc£2=%d\n",c£±,c£2);printf("c£±=%cc£2=%c\n",c£±,c£2);}μú????5.£±ê2?′ê???ê?????£?ê2?′ê?1??μ????£?ê2?′ê????-????£??a£o???£5.£2Có????Dè?o?±íê?"??"oí"?ù"£??μí3è?o??D??£-??á?μ?"??"oí"?ù"£??a£oéèóD£-?????-±í′?ê?£?è????á1??a"??"£??òò?£±±íê?£?è????á1??a"?ù"£??òò?0±íê??£μ?ê??D??£-?????-á?μ??μê±£?ò?0′ú±í"??"£?ò?·?0′ú±í"?ù"?£àyè?3&&5μ??μ?a"??"£??μí3??3?3&&5μ??μ?a£±?£5.3D′3??????÷???-±í′?ê?μ??μ?£éèa=3£?b=4£?c=5?£(£±)a+b>c&&b==c(£2)a||b+c&&b-c(3)!(a>b)&&!c||£±(4)!(x=a)&&(y=b)&&0(5)!(a+b)+c-£±&&b+c/£2?a£o(£±)0(£2)£±(3)£±(4)0(5)£±5.4óD3????êya?¢b?¢c£?óé?ü?ìê?è?£?ê?3????D×?′óμ?êy?£?a£o·?·¨£-#include<stdio.h>main(){inta,b,c;printf("??ê?è?3????êy£o");scanf("%d,%d,%d",&a,&b,&c);if(a<b)if(b<c)printf("max=%d\n",c);elseprintf("max=%d\n",b);elseif(a<c)printf("max=%d\n",c);elseprintf("max=%d\n",a);}·?·¨?t£oê1ó?ì??t±í′?ê?£??éò?ê13ìDò?ü?ó?ò?÷?¢???ú?£3ìDòè???£o#include<stdio.h>main(){inta,b,c,temp,max;printf("??ê?è?3????êy£o");scanf("%d,%d,%d",&a,&b,&c);temp=(a>b)?a:b;/*??aoíb?Dμ?′ó??′?è?temp?D*/max=(temp>c)?temp:c;/*??aoíb?Dμ?′ó??ó?c±è??£?è?×?′ó??*/printf("3????êyμ?×?′óêyê?%d\n",max);}5.5óD£-oˉêy£oD′£-3ìDò£?ê?è?x?μ£?ê?3?y?μ?£?a£o#include<stdio.h>main(){intx,y;printf("ê?è?x£o");scanf("%d",&x);if(x<£±)/*x<£±*/{y=x;printf("x=%3d,y=x=%d\n",x,y);}elseif(x<£±0)/*£±?üx-£±0*/{y=£2*x-£±;printf("x=%3d,y=£2*x-£±=%d\n",x,y);}else/*x?Y£±0*/{y=3*x-£±£±;printf("x=%3d,y=3*x-£±£±=%d\n",x,y);}}5.6??£-??°ù·???3é?¨£?òa?óê?3?μè??'A'?¢'B'?¢'C'?¢'D'?¢'E'?£90·?ò?é??a'A'£?80~90·??a'B'£?70~79·??a'C'£?60·?ò????a'D'?£?a£o3ìDòè???£o#include<stdio.h>main(){floatscore;chargrade;printf("??ê?è??§éú3é?¨£o");scanf("%f",&score);while(score>£±00||(score<0){printf("\nê?è?óD?ó,????D?ê?è?£o");scanf("%f",&score);}switch((int)(score/£±0)){case£±0:case9:grade='A';break;case8:grade='B';break;case7:grade='C';break;case6:grade='D';break;case5:case4:case3:case£2:case£±:case0:grade='E';}printf("3é?¨ê?%5.£±f£??àó|μ?μè??ê?%c?£\n",score,grade);}?μ?÷£o??ê?è?μ?êy?Y??DD?ì2é£?è?D?óú0?ò′óóú£±00£?òa?ó??D?ê?è??£(int)(score/£±0)μ?×÷ó?ê???(score/£±0)μ??μ??DD????ààDí×a??£?μ?μ?£-????Dí?μ?£5.7???¨£-??2??àóú5??μ??y??êy£?òa?ó£o¢ù?ó?üê?????êy£?¢ú·?±e′òó?3???£-??êy×?£?¢?°′??Dò′òó?3??÷??êy×??£àyè??-êy?a3£2£±£?ó|ê?3?£±£23?£?a£o#include<stdio.h>main(){longintnum;intindiv,ten,hundred,thousand,ten_thousand,place;/*·?±e′ú±í?????¢ê????¢°ù???¢?§???¢íò??oí??êy*/printf("??ê?è?£-????êy£¨0~99999£?£o");scanf("%ld",&num);if(num>9999)place=5;elseif(num>999)place=4;elseif(num>99)place=3;elseif(num>9)place=£2;elseplace=£±;printf("place=%d\n",place);ten_thousand=num/£±0000;thousand=num/£±000%£±0;hundred=num/£±00%£±0;ten=num%£±00/£±0;indiv=num%£±0;switch(place){case5:printf("%d,%d,%d,%d,%d",ten_thousand,thousand,hundred,ten,indiv);printf("\n·′Dòêy×??a£?");printf("%d%d%d%d%d\n",indiv,ten,hundred,thousand,ten_thousand);break;case4:printf("%d,%d,%d,%d",thousand,hundred,ten,indiv);printf("\n·′Dòêy×??a£o");printf("%d%d%d%d\n",indiv,ten,hundred,thousand);break;case3:printf("%d,%d,%d",hundred,ten,indiv);printf("\n·′Dòêy×??a£o");printf("%d%d%d\n",indiv,ten,hundred);break;case£2:printf("%d,%d",ten,indiv);printf("\n·′Dòêy×??a£o");printf("%d%d\n",indiv,ten);break;case£±:printf("%d",indiv);printf("\n·′Dòêy×??a£o");printf("%d\n",indiv);break;}}5.8?óòμ·¢·?μ??±?e?ù?Yà?èóìá3é?£à?èóIμíóú?òμèóú£±0íò?aê±£??±?e?éìá3飱0%£?à?èó??óú£±0íò?a£?μíóú£20íò?a£¨£±00000<I?ü£200000£?ê±£????D£±0íò?a°′£±0%ìá3é£???óú£±0íò?aμ?2?·?£??éìá3é7.5%£?£200000<I?ü400000ê±£????D£20íò?aè?°′é?ê?°ì·¨ìá3飨??í?£?£???óú£20íò?aμ?2?·?°′5%ìá3é£?400000<I?ü600000ê±£???óú40íò?aμ?2?·?°′3%ìá3é£?600000?′I?ü£±000000ê±£???óú60íòμ?2?·?°′£±.5%ìá3é£?I>£±000000ê±£?3?1y£±00íò?aμ?2?·?°′£±%ìá3é?£′ó?ü?ìê?è?μ±??à?èóI£??óó|·¢·??±?e×üêy?£òa?ó£o(£±)ó?ifó???±à3ìDò£?(£2)ó?switchó???±à3ìDò?£?a£o????à?èóê±£?òaì?±e×¢òa2?í?à?èóμ?2?í?ìá3é±èày?£àyè?£?à?èó?a£±5íò?a£????DóD£±0íò?a°′£±0%μ?±èàyìá3é£?áíía5íò?a?ò°′7.5%ìá3é?£(£±)ó?ifó???±à3ìDò?£#include<stdio.h>main(){longi;floatbonus,bon£±,bon£2,bon4,bon6,bon£±0;bon£±=£±00000*0.£±;/*à?èó?a£±0íò?aê±μ??±?e*/bon£2=bon£±+£±00000*0.075;/*à?èó?a£20íò?aê±μ??±?e*/bon4=bon£2+£200000*0.05;/*à?èó?a40íò?aê±μ??±?e*/bon6=bon4+£200000*0.03;/*à?èó?a60íò?aê±μ??±?e*/bon£±0=bon6+400000*0.0£±5;/*à?èó?a£±00íò?aê±μ??±?e*/printf("??ê?è?à?èói£o");scanf("%ld",&i);if(i<=£±00000)bonus=i*0.£±;/*à?èó?ú£±0íò?aò??ú°′0.£±ìá3é?±?e*/elseif(i<=£200000)bonus=bon£±+(i-£±00000)*0.075;/*à?èó?ú£±0íò?á£20íò?aê±μ??±?e*/elseif(i<=400000)bonus=bon£2+(i-£200000)*0.05;/*à?èó?ú£20íò?á40íò?aê±μ??±?e*/elseif(i<=600000)bonus=bon4+(i-400000)*0.03;/*à?èó?ú40íò?á60íò?aê±μ??±?e*/elseif(i<=£±000000)bonus=bon6+(i-600000)*0.0£±5;/*à?èó?ú60íò?ᣱ00íò?aê±μ??±?e*/elsebonus=bon£±0+(i-£±000000)*0.0£±;/*à?èó?ú£±00íò?aò?é?ê±μ??±?e*/printf("?±?eê?%£±0.£2f\n",bonus);}′?ìaμ?1??ü?úóú?yè·D′3???£-????μ??±?e????1?ê??£àyè?à?èó?ú£±0íò?a?á£20íòê±£??±?eó|óéá?2?·?×é3é£o¢ùà?èó?a£±0íò?aê±ó|μ?μ??±?e?£?′£±00000¢a0.£±£?¢ú£±0íò?aò?é?2?·?ó|μ?μ??±?e?£?′(num-£±00000)¢a0.075?£í?àí£?£20íò??40íò?a??????μ??±?eò2ó|óéá?2?·?×é3é£o¢ùà?èó?a£20íò?aê±ó|μ?μ??±?e£??′£±00000¢a0.£±¢a£±0íò¢a0.075£?¢ú£20íò?aò?é?2?·?ó|μ?μ??±?e£??′(num-£200000)¢a0.05?£3ìDò?D?è°?£±0íò?¢£20íò?¢40íò?¢60íò?¢£±00íò?÷1??üμ?μ??±?e????3?à′£??′bon£±?¢bon£2?¢bon4?¢bon6?¢hon£±0£?è?oó?ù?óé??÷???????ó2?·?μ??±?e?£(£2)ó?switchó???±à3ìDò?£ê?è?à?èói£?è·?¨?àó|μ?ìá3éμè??branch?ù?Ybranchè·?¨?±?e?μ0?±?e=i*0.£±£±?±?e=bon£±+(i-£±05)*0.075£2?±?e=bon£2+(i-£2*£±05)*0.0534?±?e=bon4+(i-4*£±05)*0.0356?±?e=bon6+(i-6*£±05)*0.0£±5789£±0?±?e=bon£±0+(i-£±06)*0.0£±ê?3??±?e#include<stdio.h>main(){longi;floatbonus,bon£±,bon£2,bon4,bon6,bon£±0;intc;bon£±=£±00000*0.£±;bon£2=bon£±+£±00000*0.075;bon4=bon£2+£200000*0.05;bon6=bon4+£200000*0.03;bon£±0=bon6+400000*0.0£±5;printf("??ê?è?à?èói£o");scanf("%ld",&i);c=i/£±00000;if(c>£±0)c=£±0;switch(c){case0:bonus=£±*0.£±;break;case£±:bonus=bon£±+(i-£±00000)*0.075;break;case£2:case3:bonus=bon£2+(i-£200000)*0.05;break;case4:case5:bonus=bon4+(i-400000)*0.03;break;case6:case7:case8:case9:bonus=bon6+(i-600000)*0.0£±5;break;case£±0:bonus=bon£±0+(i-£±000000)*0.0£±;}printf("?±?eê?%£±0.£2f",bonus);}5.9ê?è?4????êy£?òa?ó°′óé′óμ?D?μ??3Dòê?3??£?a£o′?ìa2éó?òà′?±è??μ?·?·¨??3???′óD??3Dò?£?ú?§?°á??-?·oíêy×éò?oó£??éò?óD?ü?àμ???Dò·?·¨?£#include<stdio.h>main(){intt,a,b,c,d;printf("??ê?è?4????êy£o");scanf("%d,%d,%d,%d",&a,&b,&c,&d);printf("\na=%d,b=%d,c=%d,d=%d\n",a,b,c,d);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(a>d){t=a;a=d;d=t;}if(b>c){t=a;b=c;c=t;}if(b>d){t=b;b=d;d=t;}if(c>d){t=c;c=d;d=t;}printf("??Dò?á1?è???£o\n");printf("%d,%d,%d,%d\n",a,b,c,d);}5.£±0óD4???2?t£??2D?·?±e?a(£2£?£2)?¢(-£2£?£2)?¢(£2£?-£2)?¢(-£2£?-£2)£??2°????a£±?£?a4???tμ????è·?±e?a£±0m?£?tò?ía?T?¨?t???£??ê?è?è?£-μ?μ?×?±ê£??ó??μ?μ??¨?t???è(?tíaμ????è?aá?)?£3ìDòè???£o#include<stdio.h>main(){inth=£±0;floatx£±=£2,y£±=£2,x£2=-£2,y£2=£2,x3=-£2,y3=-£2,x4=-£2,y4=-£2,x,y,d£±,d£2,d3,d4;printf("??ê?è?£-??μ?(x,y)£o");scanf("%f,%f",&x,&y);d£±=(x-x£±)*(x-x£±)+(y-y£±)*(y-y£±);/*?ó??μ?μ??÷?DD?μ?μ??àà?*/d£2=(x-x£2)*(x-x£2)+(y+y£2)*(y+y£2);d3=(x+x3)*(x+x3)+(y-y3)*(y-y3);d4=(x+x4)*(x-x4)*(y+y4)*(y+y4);if(d£±>£±&&d£2>£±&&d3>£±&&d4>£±)h=0;/*?D????μ?ê?·??ú?tía*/printf("??μ????è?a%d\n",h);}μúáù??μúáù?????-?·????6.£±ê?è?á????y??êymoín£??ó??×?′ó1???êyoí×?D?1?±?êy?£main(){longm,n,i=£±,j,s;scanf("%ld,%ld",&m,&n);for(;i<=m&&i<=n;i++){if(m%i==0&&n%i==0)s=i;}if(m>=n)j=m;elsej=n;for(;!(j%m==0&&j%n==0);j++);printf("s=%ld,j=%ld\n",s,j);}6.£2ê?è?£-DD×?·?£?·?±eí3??3????Dó¢??×????¢?????¢êy×?oí????×?·?μ???êy?£#include"stdio.h"main(){charc;inti=0,j=0,k=0,l=0;while((c=getchar())!='\n'){if(c>=65&&c<=90||c>=97&&c<=£±£2£2)i++;elseif(c>=48&&c<=57)j++;elseif(c==3£2)k++;elsel++;}printf("i=%d,j=%d,k=%d,l=%d\n",i,j,k,l);}6.3?óSn=a+aa+aaa+...+aa...aaa£¨óDn??a£????μ£????Daê?£-??êy×??£àyè?£o£2+£2£2+£2£2£2+£2£2£2£2+£2£2£2£2£2£¨n=5£?£?nóé?ü?ìê?è??£#include"math.h"main(){intn,sum=0,i=£±,s=£2;scanf("%d",&n);while(i<=n){sum=sum+s;s=s+£2*pow(£±0,i);i++;}printf("sum=%d\n",sum);}6.4?ó£?£¨?′?ó£±!+£2!+3!+4!+5!+...+£20!£?main(){intn,i=£±;longsum=0,s=£±;scanf("%d",&n);while(i<=n){s=s*i;sum=sum+s;i++;}printf("sum=%ld\n",sum);}6.5?ómain(){doublei=£±,j=£±,k=£±,s£±=0,s£2=0,s3=0,sum;for(;i<=£±00;i++)s£±=s£±+i;for(;j<=50;j++)s£2=s£2+j*j;for(;k<=£±0;k++)s3=s3+£±/k;sum=s£±+s£2+s3;printf("sum=%f\n",sum);}6.6′òó?3??ùóD"???é?¨êy"£??ù??"???é?¨êy"ê???£-??èy??êy£????÷??êy×?ᢷ?oíμèóú??±?éí?£àyè?£o£±53ê?£-?????é?¨êy£?òò?a£±53=£±^3+5^3+3^3?£#include"math.h"main(){intx=£±00,a,b,c;while(x>=£±00&&x<£±000){a=0.0£±*x;b=£±0*(0.0£±*x-a);c=x-£±00*a-£±0*b;if(x==(pow(a,3)+pow(b,3)+pow(c,3)))printf("%5d",x);x++;}}6.7£-??êyè?1???o?μèóú?üμ?òò×ó??oí£??a??êy?í3??a"íêêy"?£àyè?£?6μ?òò×ó?a£±?¢£2?¢3£???6=£±+£2+3£?òò′?6ê?"íêêy"?£±à3ìDò?ò3?£±000???úμ??ùóDíêêy£?2¢°′??????ê?ê?3???òò×ó£o6??its??factors??are??£±?¢£2?¢3main(){intm,i,j,s;for(m=6;m<£±0000;m++){s=£±;for(i=£2;i<m;i++)if(m%i==0)s=s+i;if(m-s==0){printf("%5ditsfastorsare£±",m);for(j=£2;j<m;j++)if(m%j==0)printf("%d",j);printf("\n");}}}?òmain(){intm,i,j,s;for(m=6;m<£±000;m++){s=m-£±;for(i=£2;i<m;i++)if(m%i==0)s=s-i;if(s==0){printf("%5ditsfastorsare£±",m);for(j=£2;j<m;j++)if(m%j==0)printf("%d",j);printf("\n");}}}6.8óD£-·?êyDòáD£o?????ó3??a??êyáDμ??°£20????oí?£main(){inti=£±,n;doublet,x=£±,y=£2,s,sum=0;scanf("%ld",&n);while(i<=n){s=y/x;sum=sum+s;t=y;y=y+x;x=t;i++;}printf("%f\n",sum);}6.9£-?ò′ó£±00?×???è×?óé????£???′???μ?oó·μ???-???èμ?£-°?£??ù?????£?ó?ü?úμú£±0′???μ?ê±12?-1y?àéù?×£?μú£±0′?·′μˉ?à??£???main(){inti,n;doubleh=£±00,s=£±00;scanf("%d",&n);for(i=£±;i<=n;i++){h*=0.5;if(i==£±)continue;s=£2*h+s;}printf("h=%f,s=%f\n",h,s);}6.£±0o?×ó3?ìò?êìa?£o?×óμú£-ìì?a??è??é??ìò×ó£?μ±?′3?á?£-°?£??12?1y??£?ó??à3?á?£-???£μú?tìì??é?ó???ê£??μ?ìò×ó3?μ?£-°?£?ó??à3?£-???£ò?oó??ìì??é???3?á??°£-ììê£??μ?£-°?á?£-???£μ?μú£±0ìì??é????ù3?ê±£?????ê£??£-??ìò×óá??£?óμú£-ìì12?a?àéùìò×ó?£main(){inti=£±,sum=0;for(;i<=£±0;sum=£2*sum+£±,i++);printf("sum=%d\n",sum);}6.£±£±ó?μü′ú·¨?ó?£?ó??·??ùμ?μü′ú1?ê??a£oòa?ó?°oóá?′??ó3?μ?μ?2?μ??????μéùóú0.0000£±?£#include"math.h"main(){floatx0,x£±,a;scanf("%f",&a);x£±=a/£2;do{x0=x£±;x£±=(x0+a/x0)/£2;}while(fabs(x0-x£±)>=0.0000£±);printf("%.3f\n",x£±);}6.£±£2ó??£?ùμü′ú·¨?ó·?3ì?ú£±.5???üμ??ù?£main(){doublex,y;x=£±.5;do{y=£2*x*x*x-4*x*x+3*x-6;x=x-y/(6*x*x-8*x+3);}while(y!=0);printf("x=%.3f\n",x);}6.£±3ó??t·?·¨?ó·?3ì?ú(-£±0£?£±0)????μ??ùmain(){doublex£±,x£2,y£±,y£2;x£±=-£±0;x£2=£±0;do{y£±=£2*x£±*x£±*x£±-4*x£±*x£±+3*x£±-6;x£±=x£±-y£±/(6*x£±*x£±-8*x£±+3);}while(y£±!=0);do{y£2=£2*x£2*x£2*x£2-4*x£2*x£2+3*x£2-6;x£2=x£2-y£2/(6*x£2*x£2-8*x£2+3);}while(y£2!=0);printf("x£±=%.3f,x£2=%.3f\n",x£±,x£2);}6.£±4′òó?ò???í?°?*************************#include"math.h"main(){inti,j,k;for(i=0;i<=3;i++){for(j=0;j<=£2-i;j++)printf("");for(k=0;k<=£2*i;k++)printf("*");printf("\n");}for(i=0;i<=£2;i++){for(j=0;j<=i;j++)printf("");for(k=0;k<=4-£2*i;k++)printf("*");printf("\n");}}μú????μú??????êy×é7.£±ó?é?·¨?ó???úμ???êy?£main(){inti,j,a??£±00??;for(i=£2;i<£±00;i++){a??i??=i;for(j=£2;j<=i;j++){if(j<i)if(a??i??%j==0)break;if(a??i??-j==0)printf("%5d",a??i??);}}printf("\n");}?ò#include"math.h"main(){staticinti,j,k,a??98??;for(i=£2;i<£±00;i++){a??i??=i;k=sqrt(i);for(j=£2;j<=a??i??;j++)if(j<k)if(a??i??%j==0)break;if(j>=k+£±)printf("%5d",a??i??);}printf("\n");}7.£2ó?????·¨??£±0????êy′óD?μ?′ó??Dò?£main(){inti,j,a??£±0??,t;for(i=0;i<£±0;i++)scanf("%d",&a??i??);for(j=£±;j<£±0;j++)for(i=0;i<=9-j;i++)if(a??i??>a??i+£±??){t=a??i+£±??;a??i+£±??=a??i??;a??i??=t;}for(i=0;i<£±0;i++)printf("%5d",a??i??);}?òmain(){staticinta??£±0??,i,j,k,t;for(i=£±;i<£±£±;i++)scanf("%d",&a??i??);for(j=£±;j<£±0;j++)for(i=£±;i<=£±0-j;j++)if(a??i??>a??i+£±??){t=a??i+£±??;a??i+£±??=a??i??;a??i??=t;}for(i=£±;i<£±£±;i++)printf("%d",a??i??);printf("\n");}7.3?ó£-??3?á3???ó???????a????oí?£main(){inti=0,j=0,a??3????3??,s£±,s£2;for(i=0;i<3;i++)for(j=0;j<3;j++)scanf("%d",&a??i????j??);s£±=a??0????0??+a??£±????£±??+a??£2????£2??;s£2=a??0????£2??+a??£±????£±??+a??£2????0??;printf("s£±=%d,s£2=%d\n",s£±,s£2);}?òmain(){staticinti,j,s£±,s£2,a??3????3??;for(i=£±;i<=3;i++)for(j=£±;j<=3;j++)scanf("%d",&a??i????j??);s£±=a??£±????£±??+a??£2????£2??+a??3????3??;s£2=a??£±????3??+a??£2????£2??+a??3????£±??;printf("%d,%d\n",s£±,s£2);}7.4ò?óD£-??ò???o?μ?êy×é??ê?è?£-??êyòa?ó°′?-à′??Dòμ?1??é???ü2?è?êy×é?D?£main(){staticinta??£±0??={£±,7,8,£±7,£23,£24,59,6£2,£±0£±};inti,j,t;scanf("%d",&a??9??);for(i=9;i>0;i--)if(a??i??<a??i-£±??){t=a??i-£±??;a??i-£±??=a??i??;a??i??=t;}for(i=0;i<£±0;i++)printf("%5d",a??i??);printf("\n");}?òmain(){staticinta??5??={£±,4,5,6,7};inti,t,b;scanf("%d",&b);for(i=0;i<5;i++){if(b<=a??i??){t=a??i??;a??i??=b;b=t;}printf("%d",a??i??);}printf("%d",b);}7.5??£-??êy×éμ??μ°′??Dò??D?′?·?£?àyè?£??-à′?3Dò?a£o8£?6£?5£?4£?£±?£òa?ó???a£o£±£?4£?5£?6£?8?£main(){inti,b??£±0??;for(i=0;i<£±0;i++)scanf("%d",&b??i??);for(i=9;i>-£±;i--)printf("%5d",b??i??);printf("\n");}7.6′òó?3?ò???????èy??D?£¨òa?ó′òó?3?£±0DD£??££±£±????£±£±????£2????£±£±????3????3????£±£±????4????6????4????£±£±????5????£±0??£±0????5????£±????main(){staticintm,n,k,b??£±5????£±5??;b??0????£±??=£±;for(m=£±;m<£±5;m++){for(n=£±;n<=m;n++){b??m????n??=b??m-£±????n-£±??+b??m-£±????n??;printf("%-5d",b??m????n??);}printf("\n");}}}?òmain(){inti,j,n,k,a??£±0????£±0??;statica??????£±??={{£±},{£±},{£±},{£±},{£±},{£±},{£±},{£±},{£±},{£±}};a??£±????£±??=£±;for(k=£2,k<£±£±;k++)for(i=£2;i<=k;i++)for(j=£2;j<=i;j++)a??i????j??=a??i-£±????j-£±??+a??i-£±????j??;for(k=£±;k<£±£±;k++)for(i=£±;i<=k;i++)for(j=£±;j<=i;j++)printf("%d",a??i????j??);}7.7′òó?"?§·??ó"£??ù???§·??óê????a?ùμ?·??ó£??üμ???£-DD?¢??£-áDoí????????oí?ù?àμè?£àyè?£?èy?×?§·??ó?a8£±635749£2òa?ó′òó?3?ó飱??n£2μ?×?è?êy113éμ??§·??ó?£?a£o#include<stdio.h>main(){inta??£±6????£±6??,i,i,k,p,m,n;p=£±;while(p==£±)/*òa?ó?×êy?a£±??£±5μ?éìêy*/{printf("Entern(n=£±??£±5)£o");scanf("%d",&n);if((n!=0)&&(n<=£±5)&&(n%£2!=0))p=0;}for(i=£±;i<=n;i++)/*3?ê??ˉ*/for(j=£±;j<=n;j++)a??i????j??=0;j=n/£2+£±;/*?¨á¢?§·??ó*/a??£±????j??=£±;for(k=£2;k<=n*n;k++){i=i-£±;j=j+£±;if((i<£±)&&(j>n)){i=i+£2;j=j-£±;}else{if(i<£±)i=n;if(j>n)j=£±;}if(a??i????j??==0)a??i????j??=k;else{i=i+£2;j=j-£±;a??i????j??=k;}}for(i=£±;i<=n;i++)/*ê?3??§·??ó*/{for(j=£±;j<=n;j++)printf("%4d",a??i????j??);printf("\n");}}7.8?ò3?£-???t??êy×é?Dμ?°°μ?£??′??????é?μ??a???ú??DDé?×?′ó£??ú??áDé?×?D?£?ò2?é?ü??óD°°μ??£main(){inta??5????5??,b??5??,c??5??,d??5????5??,k=0,l=0;inti,j;for(i=0;i<5;i++)for(j=0;j<5;j++)scanf("%d",&d??i????j??);for(i=0;i<5;i++)for(j=0;j<5;j++,a??i????j??=d??i????j??);for(i=0,k=0;i<5;i++,k++)for(j=0;j<4;j++){if(a??i????j??>=a??i????j+£±??)b??k??=a??i????j+£±??=a??i????j??;elseb??k??=a??i????j+£±??;}for(j=0,l=0;j<5;j++,l++)for(i=0;i<4;i++){if(a??i????j??<=a??i+£±????j??)c??l??=a??i+£±????j??=a??i????j??;elsec??l??=a??i+£±????j??;}for(i=0,k=0;i<5;i++,k++)for(j=0,l=0;j<5;j++,l++)if(d??i????j??-b??k??==0){if(d??i????j??-c??l??==0)printf("d??%d????%d??=%d\n",i,j,d??i????j??);elseprintf("d??%d????%d??=%disnotandi\n",i,j,d??i????j??);}}7.9óD??£±5êy°′óéD?μ?′ó?3Dò′?·??ú£-??êy×é?D£?ê?è?£-??êy£?òa?óó???°?2é?ò·¨?ò3???êy×é?Dμú?????a??μ??μ?£è?1???êy2??úêy×é?D£??ò′òó?3?"?T′?êy"#include"math.h"main(){staticinti,j,m,a??£±5??={£±,4,9,£±3,£2£±,34,55,89,£±44,£233,377,570,67£±,703,8£±£2};scanf("%d",&m);for(j=0;j<£±5;j++)printf("%4d",a??j??);printf("\n");i=7;while(fabs(i-7)<8){if(m<a??7??){if(a??i??-m==0){printf("itisat(%d)\n",i+£±);break;}i--;}elseif(m>a??7??){if(a??i??-m==0){printf("itisat(%d)\n",i+£±);break;}i++;}elseprintf("8\n");}if(fabs(i-7)-8==0)printf("Thereisnot\n");}7.£±0óD£-?a????£?12óD3DD??×?£???DDóD??80×?·??£òa?ó·?±eí3??3????Dó¢??′óD′×????¢D?D′×????¢????ò??°???ü×?·?μ???êy?£main(){inti,j=0,k=0,l=0,m=0,n=0;charstr0??30£±??,str£±??£±00??,str£2??£±00??,str3??£±00??;gets(str£±);gets(str£2);gets(str3);strcat(str0,str£±);strcat(str0,str£2);strcat(str0,str3);for(i=0;str0??i??!='\0';i++){if(str0??i??>=65&&str0??i??<=90)j++;elseif(str0??i??>=97&&str0??i??<=£±£2£2)k++;elseif(str0??i??>=48&&str0??i??<=57)l++;elseif(str0??i??==3£2)m++;elsen++;}printf("DaxieXiaoxieShuziKonggeQita\n");printf("%5d%7d%5d%6d%4d\n",j,k,l,m,n);}7.£±£±′òó?ò???í?°?£a??£a??£a??£a??£a£a??£a??£a??£a??£a£a??£a??£a??£a??£a£a£a??£a??£a??£a£a??£a??£a??£a??£amain(){inti,j,k;chara??5????5??;for(i=0;i<5;i++){for(j=0;j<5;j++){a??i????j??='*';printf("%c",a??i????j??);}printf("\n");for(k=£±;k<=i+£±;k++)printf("\40");}printf("\n");}7.£±£2óD£-DDμ???ò???????1??éò?3é?ü??£oA->Z??a->zB->Y??b->yC->X??c->x...?′μú£-??×???±?3éμú£26??×???£?μúi??×???±?3éμú£¨£26-i+£±£???×????£·?×???×?·?2?±?£?òa?ó±à3ìDò???ü?????-??£?2¢′òó?3??ü??oí?-???£main(){inti;charstr£±??£±00??,str£2??£±00??;gets(str£±);for(i=0;str£±??i??!='\0';i++)if(str£±??i??>=65&&str£±??i??<=90)str£2??i??=£±55-str£±??i??;elseif(str£±??i??>=97&&str£±??i??<=£±£2£2)str£2??i??=£2£±9-str£±??i??;elsestr£2??i??=str£±??i??;printf("%s\n%s\n",str£±,str£2);}7.£±3±à£-3ìDò£???á???×?·?′?á??ó?eà′£?2?òastrcatoˉêy?£main(){inti,j;charstr£±??£±00??,str£2??£±00??,str3??£20£±??;gets(str£±);gets(str£2);for(i=0;str£±??i??!='\0';i++)str3??i??=str£±??i??;for(j=0;str£2??j??!='\0';j++)str3??j+i??=str£2??j??;printf("%s\n%s\n%s\n",str£±,str£2,str3);}7.£±4±à£-??3ìDò£???á???×?·?′?S£±oíS£2±è??£?è?1?S£±>S£2£?ê?3?£-???yêy£?S£±=S£2£?ê?3?0£?S£±<S£2£?ê?3?£-???oêy?£2?òaó?strcpyoˉêy?£á???×?·?′?ó?getsoˉêy?áè??£ê?3?μ??yêy?ò?oêyμ??????μó|ê??à±è??μ?á???×?·?′??à??ó|×?·?μ?ASCII??μ?2??μ?£àyè?£?'A'ó?'C'?à±è£?óéóú'A'<'C'£?ó|ê?3??oêy£?óéóú'A'ó?'C'μ???2??μ?a£2£?òò′?ó|ê?3?"-£2"?£í?àí£o"And"oí"Aid"±è??£??ù?Yμú£2??×?·?±è???á1?£?'n'±è'i'′ó5£?òò′?ó|ê?3?"5"?£#include<stdio.h>#include<string.h>main(){inti,resu;chars£±??£±00??,s£2??£±00??;printf("\ninputstring£±£o");gets(s£±);printf("\nInputstring£2£o");gets(s£2);i=0;while(s£±??i??==s£2??i??&&s£±??i??!='\0')i++;if(s£±??i??=='\0'&&s£2??i??=='0')resu=0;elseresu=s£±??i??-s£2??i??;printf("\nresult£o%d\n",resu);}7.£±5±àD′£-??3ìDò,??×?·?êy×és£2?Dμ?è?2?×?·???±′μ?×?·?êy×és£±?D,2?ó?strcpyoˉêy?£??±′ê±£?'\0'ò2òa??±′1y襣?'\0'oó??μ?×?·?2???±′?£?a£o#include"stdio.h"main(){chars£±??80??,s£2??80??;inti;printf("Inputs£2£o");scanf("%s",s£2);for(i=0;i<strlen(s£2);i++)s£±??i??=s£2??i??;printf("s£±£o%s\n",s£±);}μú°???μú°?????oˉêy£±.£±D′á???oˉêy£?·?±e?óá?????êyμ?×?′ó1???êyoí×?D?1?±?êy£?ó??÷oˉêyμ÷ó??aá???oˉêy£?2¢ê?3??á1?á?????êyóé?ü?ìê?è??£maxyueshu(m,n)intm,n;{inti=£±,t;for(;i<=m&&i<=n;i++){if(m%i==0&&n%i==0)t=i;}return(t);}minbeishu(m,n)intm,n;{intj;if(m>=n)j=m;elsej=n;for(;!(j%m==0&&j%n==0);j++);returnj;}main(){inta,b,max,min;printf("entertwonumberis:");scanf("%d,%d",&a,&b);max=maxyueshu(a,b);min=minbeishu(a,b);printf("max=%d,min=%d\n",max,min);}8.£2?ó·?3ìμ??ù£?ó?èy??oˉêy·?±e?óμ±b£2-4ac′óóú0?¢μèóú0?¢oíD?óú0ê±μ??ù£?2¢ê?3??á1??£′ó?÷oˉêyê?è?a?¢b?¢cμ??μ?£#include"math.h"floatyishigen(m,n,k)floatm,n,k;{floatx£±,x£2;x£±=(-n+sqrt(k))/(£2*m);x£2=(-n-sqrt(k))/(£2*m);printf("twoshigenisx£±=%.3fandx£2=%.3f\n",x£±,x£2);}floatdenggen(m,n)floatm,n;{floatx;x=-n/(£2*m);printf("denggenisx=%.3f\n",x);}floatxugen(m,n,k)floatm,n,k;{floatx,y;x=-n/(£2*m);y=sqrt(-k)/(£2*m);printf("twoxugenisx£±=%.3f+%.3fiandx£2=%.3f-%.3fi\n",x,y,x,y);}main(){floata,b,c,q;printf("inputabcis");scanf("%f,%f,%f",&a,&b,&c);printf("\n");q=b*b-4*a*c;if(q>0)yishigen(a,b,q);elseif(q==0)denggen(a,b);elsexugen(a,b,q);}8.£2D′£-???D????êyμ?oˉêy£??ú?÷oˉêyê?è?£-????êy£?ê?3?ê?·?ê???êyμ????¢?£psushu(m)intm;{inti=£2,t;for(;i<=m;i++)if(m%i==0&&i<m)break;if(m-i==0)t=£±;elset=0;returnm;}main(){inta,s;printf("entersushuis\n");scanf("%d",&a);s=psushu(a);if(s==£±)printf("aissushu\n");elseprintf("sisnotsushu\n");}8.4D′£-??oˉêy£?ê1???¨μ?£-???t??êy×飨£3?á£3£?×a??£??′DDáD?¥???£intzhuangzhi(b)intb??3????3??;{inti,j,t;for(i=0;i<3;i++)for(j=0;j>=i&&j<3-i;j++){t=b??i????j??;b??i????j??=b??j????i??;b??j????i??=t;}}main(){inta??3????3??;inti,j;for(i=0;i<3;i++)for(j=0;j<3;j++)scanf("%d",&a??i????j??);for(i=0;i<3;i++){for(j=0;j<3;j++)printf("%d",a??i????j??);printf("\n");}zhuangzhi(a);for(i=0;i<3;i++){for(j=0;j<3;j++)printf("%d",a??i????j??);printf("\n");}}8.5D′£-oˉêy£?ê1ê?è?μ?£-??×?·?′?°′·′Dò′?·?£??ú?÷oˉêy?Dê?è?ê?3?×?·?′??£main(){charstr0??£±00??;gets(str0);fanxu(str0);puts(str0);}fanxu(str£±)charstr£±??£±00??;{inti,t,j;charstr£2??£±00??;strcpy(str£2,str£±);t=strlen(str£±);for(i=0,j=t-£±;j>-£±;i++,j--)str£±??i??=str£2??j??;}8.6D′£-oˉêy£???á???×?·?′?á??ó?£lianjie(a,b)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度智慧生活門面商鋪?zhàn)赓U合同2篇
- 2025年消防安全技術(shù)服務(wù)與消防設(shè)備采購安裝合同3篇
- 2024年煙花爆竹經(jīng)營單位主要負(fù)責(zé)人考試題庫附答案 (一)
- 2024年用電監(jiān)察員(中級(jí))職業(yè)鑒定理論考試題庫(含答案)
- 二零二五版智能化布草洗滌項(xiàng)目合同2篇
- 2025年度物流加盟合作伙伴廣告宣傳與品牌推廣協(xié)議3篇
- 2025年度個(gè)人借款合同變更與解除范本4篇
- 2025年度家庭用車個(gè)人貸款購車合同(含補(bǔ)貼政策)4篇
- 2024石頭購銷合同
- 霸王鞭舞課程設(shè)計(jì)理念
- DB13(J)T 8434-2021 民用建筑節(jié)能門窗工程技術(shù)標(biāo)準(zhǔn)(京津冀)
- 2024年在職申碩同等學(xué)力英語真題試卷題后含答案及解析4
- 預(yù)防溺水六不準(zhǔn)中小學(xué)生防溺水安全教育宣傳課件可編輯課件
- 學(xué)校廚房設(shè)備投標(biāo)方案(技術(shù)方案)
- 一年級(jí)數(shù)學(xué)加減法口算題每日一練(25套打印版)
- 電力系統(tǒng)中的虛擬電廠運(yùn)營與管理考核試卷
- Starter Unit 3 同步練習(xí)人教版2024七年級(jí)英語上冊
- 風(fēng)力發(fā)電收購協(xié)議書
- 大學(xué)生無人機(jī)創(chuàng)業(yè)計(jì)劃書
- 2024年甘肅省武威市、嘉峪關(guān)市、臨夏州中考英語真題
- DL-T573-2021電力變壓器檢修導(dǎo)則
評(píng)論
0/150
提交評(píng)論