【单选题】【消耗次数:1】
下面程序执行后的结果是() #include stdio.h void fun( ) { int i,sum=0; int a[5]={1,2,3,4,5}; for (i=0;i { if (a[i]%2==0) { sum+=a[i]; } } printf(%d,sum); } void main( ) { fun( ); }
6
15
9
11
参考答案:
复制
纠错
相关题目
【单选题】 有以下程序,程序执行后的输出结果是( ) #include int fun(int x [ ],int n) { static int sum=0,i; for(i=0; i{ sum+=x[i]; } return sum; } void main( ) { int a[ ]={1,2,3,4,5}; int b[ ]={6,7,8,9},s=0; s=fun(a,5)+fun(b,4); printf(%d\n,s); }
①  45
②  50
③  60
④  66
【简答题】 以下程序输出结果是[填空1]。#include stdio.hvoid main(){ int i, sum=0;for(i=1; i i++)sum+=i;printf(″%d\n″,sum);}
【简答题】 以下程序输出结果是[填空1]。#include stdio.hvoid main(){ int i, sum=0;for(i=1; i i++)sum+=i;printf(″%d\n″,sum);}
【简答题】 以下程序输出结果是[填空1]。#include stdio.hvoid main(){ int i, sum=0;for(i=1; i i++)sum+=i;printf(″%d\n″,sum);}
【单选题】 有以下程序,程序运行以后的输出结果是() #include stdio.h main( ) { int a[ ]={2,3,5,4},i; for(i=0;i switch(i%2) { case 0:switch(a[i]%2) {case 0:a[i]++;break; case 1:a[i]--; }break; case 1:a[i]=0; } for(i=0;i printf(\n); }
①  3 3 4 4
②  2 0 5 0
③  3 0 4 0
④  0 3 0 4
【单选题】 下面程序执行后的结果是() #include stdio.h int m=0; void fun( ) { m++; } void main( ) { m++; fun( ); m++; printf(%d,m); }
①  0
②  1
③  2
④  3
【单选题】 有以下程序,执行后输出结果是() main( ) { int m[][3]={1,4,7,2,5,8,3,6,9}; int i,j,k=2; for(i=0;i { printf(%d ,m[k][i]); } }
①  4 5 6
②  2 5 8
③  3 6 9
④  7 8 9
【单选题】 若定义数组并初始化,运行的结果是() void main( ) { int i,j,a[2][3]={{1,2,3},{4,5,6}}; for(i=0;i for(j=0;j printf(%d,a[i][j]); }
①  1,2,3,4,5,6
②  12345
③  123456
④  无法运行
【单选题】 以下程序的运行结果是( )。 void fun(int array[3][3]) { int j; for(j=0;jj++) array[1][j]=array[1][j]++; printf(\n} void main(){ int j,a[3][3]={0,1,2,1,0,4,2,4,5};fun(a);for(j=0;jj++)printf(%d,a[1][j]); printf(\n }
①  1 0 4
②  2 1 5
③  0 1 2
④  1 2 3
【简答题】 以下程序输出的结果是[填空1]。#include stdio.hvoid main(){ int x, i;for(i=1; i i++){ x=i;if(++x%2==0)if(++x%3==0)if(++x%7==0)printf(%d\n,x);}printf(“\n”);}
随机题目
【单选题】 The airplane?[填空] is taking off?is?making a lot of noise.
①  what
②  which
③  who
④  those
【单选题】 She asked me ?[填空]he was coming the next day.
①  who
②  that
③  which
④  whether
【单选题】 The earth on[填空] we live is a planet.
①  which?
②  where
③  when
④  whose
【单选题】 He is [填空] late
①  always
②  come
③  going to
④  near
【单选题】 The new monitor apparatus is[填空] controlled.
①  automatical
②  autom
③  auomatically
④  automatically
【判断题】 It’s a nice living here.
①  正确
②  错误
【单选题】 Next month I’m[填空] discussions with an agent in Brazil
①  have
②  having
③  had
④  do
【单选题】 You are not [填空] to smoke here.
①  allowing
②  permit
③  allowed
④  allowance
【单选题】 Can I have the records [填空] I lent you?
①  that
②  whom
③  those
④  whose
【单选题】 They are [填空]money for Hope Project.
①  raising
②  raised
③  raise
④  raisen