2、i]a[i+1]i=i+1输出a[i]结束第三章习题1.#include#includevoidmain(){unsignedintn;floatp,p1,r=0.09;scanf("%u",&n);p=pow(1+r,n);p1=(p-1)*100;printf("%5.2f%%",p1);}运行结果:输入,回车,见结果:2.#include#includeintmain(){intbj=1000;floatr1,r2,r3,r5,
3、r0,lx1,lx2,lx3,lx4,lx5;r1=0.0414;r2=0.0468;r3=0.0540;r5=0.0585;r0=0.0072;lx1=bj*r5;lx2=bj*(1+r2)*r3;lx3=bj*(1+r3)*r2;lx4=bj*pow(1+r1,5);lx5=bj*r0*5;printf("lx1=%flx2=%flx3=%flx4=%flx=5%f",lx1,lx2,lx3,lx4,lx5);return0;}运行结果:3.#include#include4、th.h>intmain(){longd,p;d=;p=6000;doublem,r=0.01;m=log(p/(p-d*r))/log(1+r);printf("%4.2f",m);return0;}运行结果:4.#includeintmain(){intc1,c2;c1=97;c2=98;printf("c1=%c,c2=%c",c1,c2);printf("c1=%d,c2=%d",c1,c2);return0;}运行结果:①;②;③结果不变。5.#include5、o.h>intmain(){inta,b;floatx,y;charc1,c2;scanf("a=%db=%d",&a,&b);scanf("%f%e",&x,&y);scanf("%c%c",&c1,&c2);return0;}运行结果:输入即可。6.#includeintmain(){charc1,c2,c3,c4,c5;c1='C';c2='h';c3='i';c4='n';c5='a';c1=c1+4;c2=c2+4;c3=c3+4;c4=c4+4;c5=c5+4;printf(
6、"%c%c%c%c%c",c1,c2,c3,c4,c5);return0;}运行结果:。7.#include#includeintmain(){floatr,h,pi,c,s,sb,v,vz;pi=3.;scanf("%4f%f",&r,&h);c=2*pi*r;s=pi*pow(r,2);sb=4*pi*pow(r,2);v=4/3*pi*pow(r,3);vz=s*h;printf("c=%7.2f,s=%7.2f,sb=%7.2f,v=%7.2f,vz=%7.2
7、f",c,s,sb,v,vz);return0;}运行结果:输入,得结果。第四章习题4.#includeintmain(){printf("pleaseinputthreenumbers!");longa,b,c,max;scanf("%ld,%ld,%ld",&a,&b,&c);if(a>b)if(a>c)max=a;elsemax=c;elseif(a>c)max=b;elseif(b>c)max=b;elsemax=c;printf("max=%ld",max);ret
8、urn0;}运行结果:5.#include#includevoidmain(){doublep,x;printf("Pleaseenteralessthan1000positiveNumbers!");scanf("%lf",&x);if(x<1000)p=sqrt(x);elseprintf("Inputerror,pleaseenteragain!");printf("%5.0lf