1、 第六章习题1.(1)#includemain()int i,j,k;char space= ;for(i=1;imain()int k = 4, n;for (n = 0; n main() int k = 4, n;for (n = 0; n main( )int i,sum=0;for(i=1;imain( )long i;long term,sum=0;for(i=1;imain( )long term=0,sum=0;int a,i,n;printf(“input a,n:“);scanf(“%d,%d“,for(i=1;i#includemain( )int n=1;float t
2、erm=1.0,sign=1,sum=0;while(fabs(term)=1e-4)term=sign*1.0/n;sum=sum+term;sign=sign*(-1);n+;printf(“sum=%fn“,sum);(5) #include#includemain( )int n=1,count=1;float x;double sum,term;printf(“input x:“);scanf(“%f“,sum=x;term=x;doterm=(-1)*term*x*x/(n+1)*(n+2);sum=sum+term;n=n+2;count+;while(fabs(term)=1e
3、-5);printf(“sin(x)=%f,count=%dn“,sum,count);3 #include main()int x = 0,find=0;while(!find) /*当没找到时继续执行循环 */x+;if(x%2=1find=1; 4 #include main()int i,n;long m=1,p=1;printf(“input n:“);scanf(“%d“,for(i=1;imain()float c,f;for(c=-40;c#includemain()int n;double c=0.01875,x;dox=x*pow(1+c,12)-1000;n+;while
4、(x0);printf(“x=%dn“,x);7. #includemain()int n=0;float x=100.0,a;printf(“input a:“);scanf(“%f“,dox=x*(1+a);n+;while(x#includemain( )int n=1,count=1;float sum=0,term=1.0,sign=1;doterm=sign*1.0/n;sum=sum+term;sign=sign*(-1);n=n+2;count+;while(fabs(term)=1e-4);sum=4*sum;printf(“sum=%f,count=%dn“,sum,cou
5、nt);9 #include#includemain( )int n=1,count=1;float sum=1,term=1.0;doterm=term/n;sum=sum+term;n=n+1;count+;while(fabs(term)=1e-5);printf(“e=%f,count=%dn“,sum,count);10. #include#includemain()int m;for(m=100;mmain()int i=0,n;long sum=0,term=1;printf(“Inputn:“);scanf(“%d“,doi+;term=term*i;sum=sum+term;
6、while(summain( )int i,n,m,sum=0,count=0;printf(“input n:“);scanf(“%d“,for(i=1;i0)sum=sum+m;count+;elsebreak;printf(“sum=%d,count=%dn“,sum,count); printf(“program is over!n“);13#includemain( )int i,n,m,sum=0,count=0;printf(“input n:“);scanf(“%d“,for(i=1;i0)sum=sum+m;count+;else if(mmain()int x,y,z;for (x=0;xmain()int x,y;for (x=0;xmain()int x,y,z;for (x=0;x=20;x+)for(y=0;y=33;y+)for(z=0;z=100;z+)if(x+y+z=100&5*x+3*y+z/3.0=100)