改 错
1、取{2m,3nm≥1,nl}中由小到大排列的前70项数。 #include<stdio. h void main( Double m, n; int ks /实* error站实实实实实实/ m=2;n=3; m=2,n=3 for(k=0;k<70;k++) /实实实实 error*实实兴实/ if(m<n) if(n<m) Printf(%400f", m) m =2 printf(90400f", n); return;
1、取{2m, 3n |m≥1,n≥1}中由小到大排列的前70项数。 #include<stdio.h> void main( ) {double m,n; int k; /**********error************/ m=2, n=3; for(k=0;k<70;k++) /**********error************/ if(n<m) {printf("%40.0f",m); m*=2; } else {printf("%40.0f",n); n*=3; } return; } m=2;n=3; if(m<n)
2、求1-1/2+1/3-114+.+1/99-1/100的值。 #include<stdio. h> void maino Rint i, t; S+=(float/i float s=0 for(i=t=1;<=100;++) printf("s=%ofn",s) /兴实实 error*实实实兴兴/ S+=t/i /实站实实实出兴出 error实实实出兴实实* printf("s%dⅦn",s):
2、求 1- 1/2+1/3-1/4+…+ 1/99-1/100 的值。 #include<stdio.h> void main() {int i,t; float s=0; for (i=t=1;i<=100;i++) { /***********error*************/ s+=t/i; t=-t; } /***********error************/ printf("s=%d\n",s); } s+=(float)t/i; printf("s=%f\n",s);
3、任意输入一串字符,以“?”结束,分别统计 中字母、数字和其他字符的个数 for((c=getchar)=?i if(cex='A&&c<="Z川|(c>='a'&&c<='z)nl++: int nl=0,n2=0,n3=0; error兴兴出次次 for((c=getchar)=r? /k*实实实实实出 error**实实实实实出出兴/ if(C=A&&c<=Z)&(c>'a"'&&e<='z')nl++; else ift(c>=0&&c<="9)n2++; else n3++ printf(ood, %od, %odn",nl, n2, n3);
3、任意输入一串字符,以“?”结束,分别统计其 中字母、数字和其他字符的个数。 #include<stdio.h> void main() {char c; int n1=0,n2=0,n3=0; /***********error************/ for((c=getchar())!='?') /***********error************/ if((c>='A'&&c<='Z')&&(c>='a'&&c<='z'))n1++; else if(c>='0'&&c<='9')n2++; else n3++; printf("%d,%d,%d\n",n1,n2,n3); } for(;(c=getchar())!='?';) if((c>='A'&&c<='Z')||(c>='a'&&c<='z'))n1++;