( 29 )有以下程序# include ( stdio.h )main (){ int a[5]= { 1 , 2 , 3 , 4 , 5 } , b[5] ={ O , 2 , 1 , 3 , 0 } , i , s = 0 ;for ( i = 0 ; i < 5 ; i++ ) s = s+a[b[i] ] ) ;printf ( " %d \ n ", s ) ;}程序运行后的输出结果是A ) 6B ) 10C ) 11D ) 15
( 29 )有以下程序
# include ( stdio.h )
main ()
{ int a[5]= { 1 , 2 , 3 , 4 , 5 } , b[5] ={ O , 2 , 1 , 3 , 0 } , i , s = 0 ;
for ( i = 0 ; i < 5 ; i++ ) s = s+a[b[i] ] ) ;
printf ( " %d \ n ", s ) ;
}
程序运行后的输出结果是
A ) 6
B ) 10
C ) 11
D ) 15
相关考题:
有以下程序 include main() { FILE *fp;int i,a[6]={1,2,3,4,5,6}; fp= 有以下程序 #include<stdio.h> main() { FILE *fp;int i,a[6]={1,2,3,4,5,6}; fp=fopen("d3.dat","w+b"); fwrite(a.sizeof(int),6,fp); fseek(fp,sizeof(int)*3,SEEK_SET):/*该语句使读文件的位置指针从文件头向后移动3个int型数据*/ fread(a,sizeof(int),3,fp);fclose(fp); for(i=0;i<6;i++)printf("%d,",a[i]); } 程序运行后的输出结果是A.4,5,6,4,5,6,B.1,2,3,4,5,6,C.4,5,6,1,2,3,D.6,5,4,3,2,1,
有以下程序:includemain(){int i,j;for(i=3;i>=1;i-){for(j=1;j 有以下程序: #include<stdio.h> main() { int i,j; for(i=3;i>=1;i-) { for(j=1;j<=2;j++)printf("%d",i+j); printf("\n"); } } 程序运行的结果是( )。A.2 3 4B.4 3 2C.2 3D.4 5 3 4 5 5 4 3 3 4 3 4 4 5 2 3
有以下程序:includemain(){int aa[5][5]={{1,2,3,4},{5,6,1,8},{5,9,10,2},{1,2,5,6}} 有以下程序: #include<stdio.h> main() {int aa[5][5]={{1,2,3,4},{5,6,1,8},{5,9,10,2},{1,2,5,6}}; int i,s=0; for(i=0;i<4;i++) s+=aa[i][2]; printf("%d",s); } 程序运行后的输出结果是( )。A.26B.19C.10D.20
下述程序的输出结果是()。includevoid main(){int a[5]={1,2,3,4,5};int *p=a,**q=p 下述程序的输出结果是( )。 #include<stdio.h> void main() {int a[5]={1,2,3,4,5}; int *p=a,**q=&p; printf("%d,",*(p++)); printf("%d",**q);}A.2,2B.1,1C.3,4D.1,2
以下程序的输出结果是【 】。include main() {int j,a[]={1,3,5,7,9,11,13,15},*P=a+5; f 以下程序的输出结果是【 】。include <stdio.h>main(){ int j,a[]={1,3,5,7,9,11,13,15},*P=a+5;for(j=3; j;j-){ switch(i){ case 1:case 2: printf("%d",*p++); break;case 3: printf("%d",* (-p));}}}
有以下程序:include main( ){int i,t[ ] [3] = {9,8,7,6,5,4,3,2,1};for(i=0;i 有以下程序:#include <stdio.h>main( ){int i,t[ ] [3] = {9,8,7,6,5,4,3,2,1}; for(i=0;i<3;i++) printf("%d ",t[2-i]l-i]);}程序执行后的输出结果是( )。A.7 5 3B.3 5 7C.3 6 9D.7 5 1
有以下程序:include void sum(int a[ ] ){a[0]=a[-1] +a[1];}main ( ){int a[10] = { 有以下程序:#include <stdio, h>void sum(int a[ ] ){ a[0]=a[-1] +a[1];}main ( ){ int a[10] = {1,2,3,4,5,6,7,8,9,10}; sum(a[2]); prinff("% d \n",a[2]); }程序运行后的输出结果是( )。A.6B.7C.5D.8
有以下程序:include void f(int a[],int i, int j){int t; if(i 有以下程序: #include <stdio.h> void f(int a[],int i, int j) { int t; if(i<j) { t=a[i];a[i]=a[j];a[j]=t; f(a,i+1,j-1); } } main() { int i,aa[5]={1,2,3,4,5}; f(aa,0,4); for(i=0;i<5;i++) printf("%d,",aa[i]);printf("\n"); } 执行后的输出结果是( )。A.5,4,3,2,1,B.5,2,3,4,1,C.1,2,3,4,5,D.1,5,4,3,2,
有以下程序:include void sum(int *a){a[0]=a[1];}main(){int aa[10]={1,2,3,4,5,6,7, 有以下程序: #include <stdio.h> void sum(int *a) { a[0]=a[1]; } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; for(i=2;i>=0;i--) sum(aa[i]); printf("%d\n",aa[0]); } 执行后的输出结果是( )。A.4B.3C.2D.1
下列程序的输出结果是()。include main(){int a=O,i; for (i=1;i 下列程序的输出结果是( )。 #include <stdio.h> main() { int a=O,i; for (i=1;i<5;i++) { swich(i) { case 0: case 3:a+=1; case 1: case 2:a+=2; default:a+=3; } } printf ("%d", a); }A.19B.18C.6D.8
有以下程序:include main( ){int a=1,b;for(b =1;b =8) break; if(a% 有以下程序:#include <stdio.h>main( ){ int a=1,b; for(b =1;b <=10;b++) { if(a> =8) break; if(a%2 == 1) {a + =5;continue;} a- =3; printf( "% d \n" ,b);}程序运行后的输出结果( )。A.3B.4C.5D.6
有以下程序:include prt(int * m,int n)int i;for(i =0;i 有以下程序:#include <stdio.h>prt(int * m,int n) int i; for(i =0;i<n;i ++ ) m[i] ++;main( )} int a[ ] = { 1,2,3,4,5} ,i; prt(a,5); for(i =0;i<5;i ++ ) printf( "% d," ,a[i] );}程序运行后的输出结果是( )。A.1,2,3,4,5,B.2,3,4,5,6,C.3,4,5,6,7,D.2,3,4,5,1
有以下程序 include main() {int a[]={1,2,3,4,5,6,7,8,9,10,11,12,},*p=a+5,*q=N 有以下程序#include <stdio.h>main( ){int a[ ]={1,2,3,4,5,6,7,8,9,10,11,12,},*p=a+5,*q=NULL;*q=*(p+5);printf("%d %d\n",*p,*q);}程序运行后的输出结果是A.运行后报错B.6 6C.6 11D.5 10
以下程序的输出结果是includeint a[3][3]={1,2,3,4,5,6,7,8,9,},*p;main(){p=(int*)ma 以下程序的输出结果是 #include<stdio.h> int a[3][3]={1,2,3,4,5,6,7,8,9,},*p; main() { p=(int*)malloc(sizeof(int)); f(p,a); printf("%d\n",*p); free(p);} f(int *s, int p[][3]) { *s=p[1][1];}A.1B.4C.7D.5
有以下程序 include main() { int i=5; do { if(i%3==1) 有以下程序 #include <stdio.h> main() { int i=5; do { if(i%3==1) if(i%5==2) { printf"*%d",i); break; } i++; } while(i!=0); printf("\n"); } 程序的运行结果是______。A.*7B.*3*5C.*5D.*2*6
有以下程序: #include stdio.h int a=1,b=2: void funl(int a,int b) {printf( "%d%d",a,b); } void fun2( ) { a=3;b=4; } main( ) { funl(5,6);fun2( ); printf("%d%d\n",a,b); } 程序运行后的输出结果是( )。A.1 2 5 6B.5 6 3 4C.5 6 1 2D.3 4 5 6
以下程序的输出结果是includeint a[3][3]={1,2,3,4,5,6,7,8,9,},*p;main(){p=(int*)ma 以下程序的输出结果是 #include<stdio.h> int a[3][3]={1,2,3,4,5,6,7,8,9,},*p; main() { p=(int*)malloc(sizeof(int)); f(p,a); printf("%d\n”,*p); free(p);} f(int *s,intp [][3]) { *s=p[1][1];}A.1B.4C.7D.5
下面程序运行后的输出结果是( )。 include main() {int a[]={1,2,3,4,5,6},*k[3],i=1; w 下面程序运行后的输出结果是( )。include<stdio.h>main(){int a[]={1,2,3,4,5,6},*k[3],i=1;while(i<4){ k[i-1]=a[2*i-1];printf("%d",*k[i-1]);i++;}}
以下程序的输出结果是【】。include main ( ) int a[3][3] ={{1,2,9},{3,4,8},{5,6,7} } , 以下程序的输出结果是【 】。include <stdio.h>main ( )int a[3][3] ={{1,2,9},{3,4,8},{5,6,7} } ,i,s=0;for(i=0;i<3;i++) s+ =a[i][i] + a[i][3-i-1];pfintf("% d \n" ,s);
有以下程序:includeusing namespace std;int main(){ int a=5,b=4,c=3,d=2; if(a>b>c 有以下程序: #include<iostream> using namespace std; int main() { int a=5, b=4, c=3,d=2; if(a>b>c) cout<<d<<end1; else if((c-1>=D) ==1) cout<<d+1<<end1; else cout<<d+2<<end1; return O;A.2B.3C.4D.编译时有错,无结果
下列程序的运行结果是()。include main(){int a=2,b=3,c=4; if(a 下列程序的运行结果是( )。 #include <stdio.h> main() { int a=2,b=3,c=4; if(a<b) if(b<0) c=0; else c+=1; printf("%d\n", c); }A.2B.3C.5D.4
以下程序的运行结果是______。 include main() {int a[]:{1,2,3,4,5,6,7,8,9,10,11,12 以下程序的运行结果是______。 #include <stdio.h> main() {int a[]:{1,2,3,4,5,6,7,8,9,10,11,12): int *p=a+5,*q=NULL: *q=*(p+5): printf("%d %d\n",*p,*q); }A.运行后报错B.66C.612D.5 5
有以下程序 include main( ) { FILE *fp;int i,a[6]={1,2,3,4,5,6}; fp=fopen("d3.da 有以下程序#include <stdio.h>main( ){ FILE *fp;int i,a[6]={1,2,3,4,5,6};fp=fopen("d3.dat","w+b");fwrite(a,sizeof(int),6,fp);fseek(fp,sizeof(int)*3,SEEK_SET);/*该语句使读文件的位置指针从文件头向后移动3个int型数据*/fread(a,sizeof(int),3,fp);fclose(fp);for(i=0;i<6;i++)printf("%d,",a[i]);}程序运行后的输出结果是A.4,5,6,4,5,6,B.1,2,3,4,5,6,C.4,5,6,1,2,3,D.6,5,4,3,2,1,
有以下程序:include main(){ int i,n=0;for(i=2;i 有以下程序: #include <stdio.h> main() { int i,n=0; for(i=2;i<5;i++) { do { if(i%3) continue; n++; } while(! i); n++; } printf("n=%d\n",n); } 程序执行后的输出结果是( )。A.n=5B.n=2C.n=3D.n=4
有以下程序:include main( ){int i,s=0,t[] = {1,2,3,4,5,6,7,8,9};for(i=0;i 有以下程序:#include <stdio.h>main( ){ int i,s=0,t[] = {1,2,3,4,5,6,7,8,9}; for(i=0;i<9;i+=2) s+=*(t+i); prinff("% d \n ",s);A.45B.20C.25D.36
有以下程序:include void f(int * x,int * y) int t;t= *x; *x= *y; *y=t;main ( ){in 有以下程序:#include <stdio.h>void f(int * x,int * y) int t; t= *x; *x= *y; *y=t;main ( ){ int a[8] = { 1,2,3,4,5,6,7,8} ,i, * p, * q; p=a;q =a[7]; while(p<q) { f(p,q) ;p ++ ;q --; } for(i =0;i<8;i ++ ) printf(" % d," ,a[i]); }程序运行后的输出结果是( )。A.8,2,3,4.,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,
以下程序的输出结果是()。includeint fan(int);main(){int w=5; fun(w);printf("\n");} 以下程序的输出结果是( )。 #include <stdio.h> int fan(int); main() { int w=5; fun(w); printf("\n"); } fun(int k) { if(k>0) fun(k-1); printf("%d",k); }A.5 4 3 2 1B.0 1 2 3 4 5C.1 2 3 4 5D.5 4 3 2 1 0