资源描述:
《上机调试实验程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、P1403#includeintmain(){intp,r,n,m,temp;printf("请输入两个正整数n,m:");scanf("%d,%d",&n,&m);if(nintmain(){inta,n,i=1,sn=0,tn=0;printf("a,n=:")
2、;scanf("%d,%d",&a,&n);while(i<=n){tn=tn+a;sn=sn+tn;a=a*10;++i;}printf("a+aa+aaa+...=%d",sn);}P1406#includeintmain(){doubles=0,t=1;intn;for(n=1;n<=20;n++){t=t*n;s=s+t;}printf("1!+2!+...+20!=%22.15e",s);}P1408#includeintmain(){inti,j,k,n;printf("parcissusnu
3、mbersare");for(n=100;n<=1000;n++){i=n/100;j=n/10-i*10;k=n%10;if(n==i*i*i+j*j*j+k*k*k)printf("%d",n);}printf("");}P1409#includeintmain(){intm,s,i;for(m=2;m<=1000;m++){s=0;for(i=1;i<=m;i++)if(m%i==0)s=s+i;if(s==m){print("%d,itsfactorsare",m);for(i=1;i<=m;i++)if(m%i==0
4、)printf("%d",i);printf("");}}return0;}P14010#includeintmain(){inti,n=20;doublea=2,b=1,s=0,t;for(i=1;i<=n;i++){s=s+a/b;t=a;a=a+b;b=t;}printf("sum=%16.10f",s);}P14013#include#includeintmain(){floata,x0,x1;printf("enterapositivenumber:");scanf("%f",&
5、a);x0=a/2;x1=(x0+a/x0)/2;do{x0=x1;x1=(x0+a/x0)/2;}while(fabs(x0-x1)>=1e-5);printf("Thesquarerootof%5.2fis%8.5f",a,x1);}P14014#include#includeintmain(){doublex1,x0,f,f1;x1=1.5;do{x0=x1;f=((2*x0-4)*x0+3)*x0-6;f1=(6*x0-8)*x0+3;x1=x0-f/f1;}while(fabs(x1-x0)>=1e-
6、5);printf("Therootofequationis%5.2f",x1);}