阅读程序写结果试题
第四章 选择结构 (共20道题)
1. (于蕾)
#include int x,y,t; x=7;y=9; if(x printf(\"%d,%d\\n\" , x,y ); } 运行结果: 9,7 2. (于蕾) #include int x=1,a=2,b=3; switch(x) { case 1: a--; break; case 2: b++; break; case 3: a++;b++; } printf(\"\\na=%d,b=%d\\n\} 运行结果: a=1,b=3 3. (于蕾) #include char ch1 = 'E'; if(ch1 >= 'A') 文案大全 标准实用 ch1++; else ch1+=32; printf(\"ch1 = %c\\n\} 运行结果: ch1= F 4. (于蕾) #include int x,y,t; x=5;y=3; if(x>y) { t=x;x=y;y=t;} printf(\"%d,%d\\n\" , x,y ); } 运行结果: 3,5 5. (王伟) #include int a,b,c,m; printf(\"Enter three integers:\"); scanf(\"%d%d%d\ if(a<=b) m=a; else m=b; if(c 输入:21 22 23<回车> 运行结果: m=21 文案大全 标准实用 6. (王伟) #include char ch1='a',ch2='B',ch3='E'; if(ch1>ch2) if(ch2>ch3) ch3++; else --ch3; printf(\"ch3=%c\\n\ return 0; } 运行结果: ch3=D 7. (王伟) #include float x,y; scanf(\"%f\ switch((int)x/10) { case 0: y=1.0; printf(\"y=%f\\n\ case 1: y=2*x+1; printf(\"y=%f\\n\ case 2: y=3*x*x+2; printf(\"y=%f\\n\ default: printf(\"No definition.\\n\"); } return 0; } 输入:15.3<回车> 运行结果: y=31.600000 文案大全 标准实用 8. (王伟) #include char ch1='A',ch2='B'; switch(ch1) { case 'A': switch(ch2) { case 'B': printf(\"Good!\\n\");break; case 'A': printf(\"Better!\\n\");break; } case 'B': printf(\"Best!\\n\"); break; } return 0; } 运行结果: Good! Best! 9. (王锋) #include float score; score = 100; if (score<60) printf(\"E\\n\"); else switch( ( int ) score / 10 ) { case 10: case 9: printf(\"A\\n\"); case 8: printf(\"B\\n\"); case 7: printf(\"C\\n\"); break; case 6: printf(\"D\\n\"); break; default: printf(\"Error\\n\"); } } 运行结果: 文案大全 标准实用 A B C 10. (王锋) #include int i=0,a=2; if(i==0) printf(“**”); else printf(“$$”); printf(“*”); } 运行结果: *** 11. (王锋) #include int m=10,n=0,p=4,q=20; if (m) if (n) q=15-m; else q=25+m; else if (p) } 运行结果: q=35 12. (王锋) #include int a=1,b=0; switch(a) 文案大全 q=q+p; printf(“q=%d\\n”,q); 标准实用 { case 1: switch (b) { case 0: printf(“**0**”); break; case 1:printf(“**1**”);break; } case 2: printf(“**2**”);break; } } 运行结果: **0****2** 13. (宋昕) #include int a=2,b=7,c=5; switch (a>0){ case 1: switch (b<0){ case 1: printf(\"@\"); break ; case 2: printf(\"!\"); break ; } case 0: switch (c==5){ case 1: printf(\"*\") ; break ; default : printf(\"#\") ; break ; } default : printf(\"&\"); } printf(\"\\n\"); return 0; } 运行结果: *& 14. (宋昕) #include int a=0,b=1,c=0,d=20; if(a) d=d-10; else if (!b) if(!c) d=15; 文案大全 标准实用 else d=25; printf(\"d=%d\\n\ return 0; } 运行结果: d=20 15. (宋昕) #include case 0: printf(\"**0**\");break; case 1:printf(\"**1**\");break; case 2:printf(\"**2**\");break; } return 0; } 运行结果: **1** 16. (宋昕) #include scanf(\"%d\ y = x>12 ? x + 10 : x - 12; printf(\"%d\\n\ return 0; } 输入:12<回车> 运行结果: 0 17. (宋昕) #include float x, y; char op; double r; 文案大全 标准实用 scanf(\"%c%f%f\ switch(op) { case '+': r = x + y; break; case '-': r = x - y; break; case '*': r = x * y; break; case '/': r = x / y; break; } printf(\"%.1f\ return 0; } 输入:3.5<回车> 运行结果: 0.6 18. (王勇超) #include \"stdio.h\" void main( ) { int a=7; if(a>9 || a<10) a=a/3; else a=a%3; printf(\"a=%d\} 运行结果: a=2 19. (王勇超) #include int a=20; switch(a%3) { case 0: printf(\"0\"); case 1: printf(\"1\"); case 2: printf(\"2\"); default: printf(\"3\"); } printf(\"4\"); 文案大全 标准实用 } 运行结果: 234 20. (王勇超) #include int a=2,b=5,c=8,t; if ( a < b ) { t = a; a = b; b = t; } if ( b < c ) { t = b; b = c; c = t; } if ( a < b ) { t = a; a = b; b = t; } printf( \"%d,%d\\n\} 运行结果: 8,1 第五章 循环结构 共20道题 1. (于蕾) #include int number , digit; number = 1234; while ( number != 0 ) { digit = number%10 ; printf( \"%d\" , digit ) ; number = number / 10 ; } } 运行结果: 4321 2. (于蕾) #include 文案大全 标准实用 int i; for(i=1;i 运行结果: 1 4 9 16 3. (于蕾) #include int i,s,x; s=0; x=15; for(i=1;i<=5;i++) if (x%i==0) s= s + i; printf(\"i=%d,s=%d\\n\} 运行结果: i=6,s=9 4. (于蕾) #include int counter=1; while(counter <= 5) { printf(\"%d \\n\ counter++; } } 运行结果: 1 2 3 4 文案大全 标准实用 5 5. (王伟) #include int i,sum,m,a; sum=0; m=5; for(i=0;i<=3;i++) { scanf(\"%d\ if(a>m) sum+=a; } printf(\"sum=%d\\n\ return 0; } 输入:2 10 8 3<回车> 运行结果: sum=18 6. (王伟) #include int i,j,k; for(i=1;i<=4;i++) { for (j=1;j<5-i;j++) printf(\" \"); for(k=1;k<=i;k++) printf(\"*\"); printf(\"\\n\"); } return 0; } 运行结果: * ** *** **** 文案大全 标准实用 7. (王伟) #include int i,j; i=1; while(i<5) { for(j=1;j<2*i+1;j++) printf(\"%c\ printf(\"\\n\"); i++; } return 0; } 运行结果: ## #### ###### ######## 8. (王伟) #include int i=10,m=0,n=0; do { if(i%2!=0) m=m+i; else n=n+i; i--; }while(i>=0); printf(\"m=%d,n=%d\\n\ return 0; } 运行结果: m=25,n=30 9. (王锋) #include 文案大全 标准实用 void main() { int sum=0,n; scanf(\"%d\ while(n<=5) { sum+=n; n++; } printf(\"sum=%d\} 输入:1<回车> 运行结果: sum=15 10. (王锋) #include int i, j; for(i=2;i>=0;i--) { for(j=1;j<=i;j++) printf(\"*\"); for(j=0;j<=2-i;j++) printf(\"!\"); printf(\"\\n\"); } } 运行结果: **! *!! 11. (王锋) #include int a,b; for(a=1,b=1;a<=100;a++) { if(b>20) break; 文案大全 标准实用 if(b%4==1) { b=b+4; continue; } b=b-5; } printf(\"a=%d\\n\} 运行结果: a=6 12. (王锋) #include char k; int i; for(i=1;i<3;i++) { scanf(\"%c\ switch(k) { case '0': printf(\"another\\n\"); case '1': printf(\"number\\n\"); } } } 输入:01<回车> 运行结果: another number number 13. (宋昕) #include int i, s = 0; for(i = 1; i < 10; i++) { s += i * i; 文案大全 标准实用 if(s > 10) break; } printf(\"i=%d, s=%d\\n\ return 0; } 运行结果: i=3, s=14 14. (宋昕) #include char ch; while((ch=getchar())!='\\n') { if (ch>='A'&&ch<='Z') ch=ch+32; else if (ch>='a'&&ch<='z') ch=ch-32; printf(\"%c\ } } 输入:ABCdef<回车> 运行结果: abcDEF 15. (宋昕) #include int a, b; for (a = 1, b = 1 ; a <= 100 ; a++) { if (b >= 9) break; if (b % 3 == 1) { b += 3 ; continue ; } b -= 5; } printf(\"%d,%d\\n\ 文案大全 标准实用 return 0; } 运行结果: 4,10 16. (宋昕) #include int i = 0,j = 0; while (i < 10) i++; while (j++ < 10) ; printf(\"i=%d,j=%d\\n\ return 0; } 运行结果: i=10,j=11 17. (王勇超) #include \"stdio.h\" void main( ) { int i,j,t; for(i=1,j=10;i<3;i++,j--) t=i+j; t++; printf(\"%d,%d\} 运行结果: 8,12 18. 王勇超) #include \"stdio.h\" void main() { int i=10,j; do { j = i%2; printf( \"%d\ i--; 文案大全 标准实用 } while ( i> 4 ); } 运行结果: 010101 19. (王勇超) #include \"stdio.h\" void main() { int i=7,j; while ( i> 2) { j = i%2; printf( \"%d\ i--; } printf( \"%d\ } 运行结果: 101012 20. (王勇超) #include int i,j,t=0; for(i=3;i>0;i--) for(j=0;j<4;j++) t+=j; printf(\"t=%d\} 运行结果: t=18 第六章 函数 共40道题 1. (王伟) #include 文案大全 标准实用 { int x=3,n=3; long p; p=fun(x,n); printf(\"p=%ld\\n\ return 0; } long fun(int x,int n) { int i; long p=1; for(i=0;i 2. (王伟) #include char ch; while((ch=getchar())!='\\n') { if(isDigit(ch)) putchar(ch); } printf(\"\\n\"); return 0; } int isDigit(char ch) { if(ch>='0' && ch<='9') return 1; else return 0; } 输入:Abc1d23eF45g<回车> 运行结果:12345 文案大全 标准实用 3. (王伟) #include void odddivisor(int n); int main() { int n; scanf(\"%d\ odddivisor(n); return 0; } void odddivisor(int n) { int i; for(i=3;i<=n/2;i=i+2) if(n%i==0) printf(\"%5d\ printf(\"\\n\"); } 输入:15<回车> 运行结果: 3 5 4. (王伟) #include int a=1,b=2; a=a+b; print(); printf(\"%d %d\\n\ return 0; } void print() { int b=3; printf(\"%d %d\\n\} 运行结果: 5 3 3 2 文案大全 标准实用 5. (王伟) #include int x=1; x=fun1(x); printf(\"%d\\n\ return 0; } int fun1(int x) { x++; fun2(x); return x; } void fun2(int x) { x++; } 运行结果: 2 6. (王伟) #include int fun1(int a,int b,int c); int main() { int a=11,b=21,c=31; fun1(a,b,c); printf(\"%d %d %d\\n\ return 0; } int fun1(int a,int b,int c) { a=a+10; b=b+10; c=c+10; return c; } 运行结果: 文案大全 标准实用 11 21 31 7. (王伟) #include fun(7); printf(\"\\n\"); return 0; } void fun(int x) { if(x/2>1) fun(x/2); printf(\"%5d\} 运行结果: 3 7 8. (王伟) #include int i,a[5]={1,2,3}; fun(a); for(i=0;i<5;i++) printf(\"%5d\ printf(\"\\n\"); return 0; } void fun(int a[]) { int i; for(i=0;i<5;i++) a[i]+=5; } 运行结果: 6 7 8 5 5 9.(于蕾) #include 文案大全 标准实用 void fun ( int k ) ; void main ( ) { int w = 5 ; fun ( w ) ; printf ( \"\\n\" ) ; } void fun ( int k ) { if ( k>0 ) fun ( k-1 ) ; printf ( \"%d\" , k ) ; } 运行结果: 012345 10. (于蕾) #include int a=2; f1(); { int a=3; printf(\"a2=%d\\n\} printf(\"a3=%d\\n\} void f1(void) { printf(\"a1=%d\\n\} 运行结果: a1=1 a2=3 a3=2 11. (于蕾) 文案大全 标准实用 #include void f(int a, int b, int *c) { a=20; b=10; *c=a+b; } void main() { int a=10,b=20,c=30,d=40; f(a,b,&c); printf(\"%d,%d,%d\\n\} 运行结果: 10,20,30 12. (于蕾) #include void swap(int a,int b); void main() { int a=2,b=3; printf(\"a=%d,b=%d\\n\ swap(a,b); printf(\"a=%d,b=%d\\n\} void swap(int a,int b) { int c; c=a; a=b; b=c; } 运行结果: a=2,b=3 a=2,b=3 13. (于蕾) #include void fun(int a,int b,int c); void main() { int x=10,y=20,z=30; 文案大全 标准实用 fun(x,y,z); printf(\"%d,%d,%d\\n\} void fun(int a,int b,int c) { a=456;b=567;c=678; } 运行结果: 10,20,30 14. (于蕾) #include int i;float s=0.0; for(i=1;i int i;float a=0.0; for(i=1;i<3;i++) a=a+f(i); printf(\"a=%.4f\\n\} 运行结果: a=1.0000 15. (于蕾) #include int a=2,i; for(i=0;i<3;i++) printf(\"%d\ } int f(int a) { int b=0,c=3; b++; 文案大全 标准实用 c++; return(a+b+c); } 运行结果: 567 16. (于蕾) #include int i,x; for(i=0;i<=2;i++) x=fun(); printf(\"%d\\n\ } int fun() { int x=3; x++; return x; } 运行结果: 4 17. (王锋) #include float add(float x,float y); void main( ) { float a,b,c; a=1.0; b=2.0; c=add(a,b); printf(\"%f\\n\} float add(float x,float y) { float z; z=x+y; return(z); } 文案大全 标准实用 运行结果: 3.000000 18. (王锋) #include void fun(int x, int cp, int dp) { cp=x++; dp=++x; } void main(void) { int a,c=80, d=-20; a=30; fun(a,c,d); printf(\"%d,%d\\n\} 运行结果: 80,-20 19. (王锋) #include int i=2,p; p=f(i,i+1); printf(\"%d\\n\} int f(int a,int b) { int c; if(a>b) c=1; else if (a==b) c=0; else c=-1; return (c); } 运行结果: 文案大全 标准实用 -1 20. (王锋) #include if(n= =1) return 1; else return fun(n-1)+3; } void main() { int i,j=0; for(i=1;i<4;i++) j=j+fun(i); printf(\"j=%d\\n\} 运行结果:j=12 21. (王锋) #include int t; if(x void main() { int a=4,b=3,c=5; f(a,b); f(a,c); f(b,c); printf(\"%d,%d,%d\} 运行结果: 4,3,5 22. (王锋) #include int c; 文案大全 标准实用 if(n==1) c=10; else c=age(n-1)+2; return(c); } void main() { printf(\"%d\} 运行结果: 18 23. (王锋) #include printf(\"Hello, world!\\n\"); } void three_hellos(void) { int counter; for (counter =1;counter <= 3;counter++) hello_world(); } void main(void) { three_hellos(); } 运行结果: Hello, world! Hello, world! Hello, world! 24. (王锋) #include int x,i=1,k=3; x=f(i,k); printf(\"x=%d \\n\ 文案大全 标准实用 } int f(int a,int b) { int M=0; while(b!=0) { M=M+a; b--; } return M; } 运行结果: x=3; 25. (宋昕) #include f(int b[ ],int m,int n) { int i,s = 0; for(i = m;i < n;i++) s += b[i]; return s; } int main() { int x,a[ ] = {1,2,3,4,5,6,7,8,9}, *p = a; x = f(p,3,7); printf(\"x=%d\\n\ return 0; } 运行结果: x=22 26. (宋昕) #include int x = 7; printf(\"i = %d; j = %d; x = %d\\n\} int main() { 文案大全 标准实用 int i = 2, x = 5, j = 7; fun(j, 6); printf(\"i = %d; j = %d; x = %d\\n\ return 0; } 运行结果: i = 7; j = 6; x = 7 i = 2; j = 7; x = 5 27. (宋昕) #include int i=0; while(a[i]<=10) { printf(\"%d\ i++; } } int main() { int a[]={1,7,17,9,11,34}; f(a+1); } 运行结果: 7 28. (宋昕) #include void add(int x, int y, int z) { z = x + y; x = x * x; y = y * y; printf(\"(2) x = %d y = %d z = %d\\n\} int main() { int x = 2, y = 3, z = 0; printf(\"(1) x = %d y = %d z = %d\\n\ 文案大全 标准实用 add(x, y, z); printf(\"(3) x = %d y = %d z = %d\\n\ return 0; } 运行结果: (1) x = 2 y = 3 z = 0 (2) x = 4 y = 9 z = 5 (3) x = 2 y = 3 z = 0 29. (宋昕) #include x1 = x; x = y; y = x1; } int main() { int x3 = 10, x4 = 20; sub(x3, x4); sub(x2, x1); printf(\" %d, %d, %d, %d\\n\ return 0; } 运行结果: 10, 20, 40, 40 30. (宋昕) #include void cube() { x = x * x * x; } int main() { x = 5; cube(); 文案大全 标准实用 printf(\" %d\\n\ return 0; } 运行结果: 125 31. (宋昕) #include invert(int *s, int i, int j) { int t; if(i < j) { invert(s, i + 1,j - 1); t = *(s + i); *(s + i) = *(s + j); *(s + j) = t; } } void main( ) { int a[6] = {10, 6, 23, -90, 0, 3}, i; invert(a, 0, 5); for(i = 0; i < 6; i++) printf(\"%d, \ printf(\"\\n\"); } 运行结果: 3,0,-90,23,6,10 32. (宋昕) int func(int a[][3]) { int i,j,sum=0; for(i=0;i<3;i++) for(j=0;j<3;j++){ a[i][j]=i+j; if(i==j) sum = sum+a[i][j]; } return sum; } int main() 文案大全 标准实用 { int a[3][3]={1,3,5,7,9,11,13,15,17}; int sum; sum=func(a); printf(\"sum=%d\ return 0; } 运行结果: sum=6 33. (王勇超) # include for(i=2; i>0; i--) fun( ); } void fun() { i*=2; printf(\"i=%d\\n\} 运行结果: i=20 i=40 34.(王勇超) #include if(n<=1) return 1; else return fun(n-1)*n; } void main() { int i,j=0; for(i=1;i<=3;i++) j+=fun(i); 文案大全 标准实用 printf(\"j=%d\\n\} 运行结果: j=9 35. (王勇超) #include int t; if (a > b) t = a/b; else t = a%22; return t; } void main() { int a=33, b=22,c; c=funa(a,b); printf(\"c=%d\\n\} 运行结果: c=1 36. (王勇超) # include for(i=2; i>0; i--) fun(i); } void fun(int i) { i*=2; printf(\"+%d+\} 运行结果:+4++2+ 37. (王勇超) 文案大全 标准实用 # include int x=879; fun(x); } void fun(int n) { int a,b,c,t; a = n % 10; b = (n/10) % 10; c = (n/100) % 10; if ( a < b ) { t = a; a = b; b = t; } if ( b < c ) { t = b; b = c; c = t; } if ( a < b ) { t = a; a = b; b = t; } printf( \"%d\ } 运行结果:8 38.(王勇超) #include int t; if (a > b) { t = a; a = b; b = t; } return t; } void main() { int a=33, b=22,c; c=funa(a,b); printf(\"c=%d\\n\} 运行结果: c=33 文案大全 标准实用 39. (王勇超) #include int z; z=x%10; x=y%10; y=z; z=x; return z; } void main() { int a=38, b=29,c; c=swap(a,b); printf(\"%d%d\\n\} 运行结果: 389 40. (王勇超) #include if(n==1) printf(\"*\\n\"); else { printf(\"-\"); fun(n-1); } } void main() { int i,j=0; for(i=1;i<4;i++) fun(i); printf(\"XiaoXin!\"); } 运行结果: * 文案大全 标准实用 -* --* XiaoXin! 第七章 数组 共40道题 1. (王锋) #include int a[2][3]={{3,2,7},{4,8,6}}; int i,j,m=0; for(i=1;i<=1;i++) for(j=0;j<=i;j++) m=m+a[i][j]; printf(\"m=%d\} 运行结果: m=12 2. (王锋) #include int array[10] = {1, 2, 4, 5, 6, 0, 0, 0, 0, 0}, i; printf(\"\\n\"); for (i=0; i<10; i++) printf(\"%3d \ printf(\"\\n\"); for (i=9; i>=2; i--) array[i] = array[i-1]; array[2] = 3; for (i=0; i<10; i++) printf(\"%3d \ printf(\"\\n\"); } 运行结果: 文案大全 标准实用 1 2 4 5 6 0 0 0 0 0 1 2 3 4 5 6 0 0 0 0 3. (王锋) #include 运行结果:CDG 4. (王锋) #include 运行结果: Hello Teachers,Students. char a[30]=\"Hello \"; char b[10]=\"Students\"; char c[10]=\"Teachers\"; strcat(a,c); printf(\"%s,%s.\\n\ char a[]=\"ABCDEFGH\char *p1,*p2; int k; p1=a; p2=b; for(k=0;k<=7;k++) if (*(p1+k)==*(p2+k)) printf(\"%c\ printf(\"\\n\"); 文案大全 标准实用 5.(王锋) #include void inv(int x[],int n); void main() { int i, a[10]={3,7,9,11,0,6,7,5,4,2}; inv(a, 10); printf(\"The array has been reverted.\\n\"); for(i=0;i<10;i++) printf(\"%d,\ printf(\"\\n\"); } void inv(int x[], int n) { int t,i,j,m=(n-1)/2; for(i=0;i<=m;i++) { j=n-1-i; t=x[i]; x[i]=x[j]; x[j]=t; } } 运行结果: The array has been reverted. 2,4,5,7,6,0,11,9,7,3, 6. (王锋) #include float a[3][3]={1,2,3,4,5,6,7,8,9},sum=0; int i; printf(\"please input rectangle element:\\n\"); for(i=0;i<3;i++) sum=sum+a[i][i]; printf(\"duijiaoxian he is %6.2f\} 运行结果: please input rectangle element: duijiaoxian he is 15.00 7. (宋昕) #include 文案大全 标准实用 int main() { int i=1,n=3,j,k=3; int a[5]={1,4,5}; while(i<=n&&k>a[i]) i++; for(j=n-1;j>=i;j--) a[j+1] = a[j]; a[i] = k; for(i=0;i<=n;i++) printf(“%2d”,a[i]); return 0; } 运行结果: 1 3 4 5 8. (王锋) #include int a[10]={0,1,2,3,4,5,6,7,8,9}, b[10],i,sum=0; for(i=1;i<10;i++) { b[i]=a[i-1]+a[i]; sum=sum+b[i]; } for(i=1;i<10;i++) if(i%3==0) sum=sum+b[i]; printf(\"sum=%3d\} 运行结果: sum=114 9. (王勇超) #include int a[5]={2,6,1,3,4},n=5,i,j,t; for(i=0,j=1;j 文案大全 标准实用 } for(i=0;i 运行结果: 22121 10. (王勇超) #include void funa(int x[],int n); void main() { int i, a[5]={3,7,9,11,0}; funa(a, 5); for(i=0;i<5;i++) printf(“%d,”,a[i]); printf(“\\n”); } void funa(int x[], int n) { int t,i,j,m=(n-1)/2; for(i=0;i<=m;i++) { j=n-1-i; t=x[i]; x[i]=x[j]; x[j]=t; } } 运行结果: 0,11,9,7,3, 11. (王勇超) #include int a[5]={24,15,33,64,45},n=5,i,j,t; for(i=0;i printf(\"%d,\} 文案大全 标准实用 运行结果: 5,4,3,5,4, 12. (王勇超) #include int a[5],i,j,t; for(i=4;i>=0;i--) scanf(\"%d\ for(i=0;i<5;i++) a[i]=a[i]+10; for(i=0;i<5;i++) printf(\"%d,\} 输入:42 31 24 15 16<回车> 运行结果: 26,25,34,41,52 13. (王勇超) #include char a[][5]={\"Zhong\ printf(\"%s\\n%s\\n\} 运行结果: ZhongGong Gong 14. (王勇超) #include int a[3][3]={0,1,2,3,4,5,6,7,8},i,j,t; for(i=0;i<3;i++) for(j=0;j<3;j++) a[i][j]+=a[i][0]; for(i=0;i<3;i++) printf(\"%d,\} 运行结果: 0,10,20 文案大全 标准实用 15. (王勇超) #include int a[3][3]={1,2,3,4,5,6,7,8,9},i,j; for(i=0;i<3;i++) for(j=0;j<3;j++) a[i][j]+=a[i][2]; while(i>0) { i--; printf(\"%d,\ } } 运行结果: 18,11,4 16. (王勇超) #include int i,j; char a[10]={\"ABCDEFGHIJ\ for(i=0;i<10;i++) a[i]=a[i]+3; printf(\"%c\\n\} 运行结果: J 17. (王伟) #include int i,a[10]={0,1,2,3,4,5,6,7}; for(i=1;i<9;i++) a[i]=a[i-1]+a[i+1]; printf(\"%d%d\\n\ return 0; } 运行结果: 2027 文案大全 标准实用 18. (王伟) #include int i,a[]={1,2,3,4,5,6,7,8,9,10}; for(i=0;i<5;i++) a[i]=i+2; for(i=9;i>=0;i--) if(a[i]%3==0) printf(\"%d\\n\ return 0; } 运行结果: 9 6 6 3 19. (王伟) #include int num=13,len=0,i=0,a[30]; do { a[len]=num%2; num=num/2; len++; }while(num);