【单选题】程序段 int a=1,b=2, c=3, t; while (a<b<c) {t=a; a=b; b=t; c--;} printf(“%d,%d,%d”,a,b,c); 的运行结果是()。A.1,2,0B.2,1,0C.1,2,1D.2,1,1
【单选题】程序段 int a=1,b=2, c=3, t; while (a<b<c) {t=a; a=b; b=t; c--;} printf(“%d,%d,%d”,a,b,c); 的运行结果是()。
A.1,2,0
B.2,1,0
C.1,2,1
D.2,1,1
参考答案和解析
循环执行多次,但最终会跳出循环
相关考题:
下面程序的运行结果是 : 【 1 0 】 。fun(int t[],int n){ int i,m;if(n==1)return t[0];elseif(n=2){m=fun(t,n-1); return m; }}main(){ int a[]={11,4,6,3,8,2,3,5,9,2};printf(" % d\n",fun(a,10));}
有以下程序#include stdio.hmain(){ int a=5,b=1,t;t=(a2)|b; printf("%d\n",t);}程序运行后的输出结果是A)21B)11C)6D)1
下面程序运行后的输出结果是( )。struct abc{int a,b,c;}main(){struct abc s[2]={{1,2,3},{4,5,6}};int t;t=s[0].a+s[1].b;printf("%d\n",t);}A.5 B.6 C.7 D.8
有下列程序: main() { int t,a=1,b=5,c=-2; while(a>b>C) { t=a;a=b;b=t;c++;} printf("%d,%d,%d",a,b,c); } 程序的输出结果是( )。A.1,5,0B.1,5,-2C.5,1,-1D.5,1,-2
(39)有以下程序#include stdio.hmain(){ int a=5,b=1,t;t=(a2|b); printf(“%d\n”,t)}程序运行后的输出结果是A)21 B)11 C)6 D)1
下面程序段的运行结果是void main(){int t,a,b,c;a=1;b=2;c=2:while(a{t=a;a=b;b=t;c--;}cout }A.1,2,0B.2,1,0C.1,2,1D.2,1,1
下列程序执行的结果是()。A=1;b=2;c=3;While(bac){t=a;a=b;b=t;c--;}printf(“%d,%d,%d”,a,b,c); A.1,2,0B.2,1,0C.1,2,1D.2,1,1
下面程序段的运行结果是 void main() { int t,a,b,c; a=1;b=2;C=2; while(a<b<c) { t=a;a=b;b=t;c--;} cout << a << " ," << b << " ," << c; }A.1,2,0B.2,1,0C.1,2,1D.2,1,1
下面程序的运行结果是( )。include define SlZE 12 main() {char s[SIZE];int i;for(i=0 下面程序的运行结果是( )。include<stdio.h>define SlZE 12main(){char s[SIZE];int i;for(i=0;i<SIZE;i++) s[i]='A'+i+32;sub(s,5,SIZE-1);for(i=0;i<SIZE;i++)printf("%c",s[i]);printf("\n");}sub(char *a,int t1,int t2){ char ch;while(t1<t2){ ch=*(a+t1);*(a+t1)=*(a+t2);*(a+t2)=ch;t1++;t2--;}}
下列程序的运行结果是()。includevoid fun(int*s,int*p){ static int t=3;*p=s[t];t--; 下列程序的运行结果是( )。#include<stdio.h>void fun(int*s,int*p){ static int t=3; *p=s[t]; t--;}void main(){ int a[]={2,3,4,5),k; int x; for(k=0;k<4;k++) { fun(a,x); printf("%d,",x); }}A.5,4,3,2B.2,3,4,5,C.2,2,2,2,D.5,5,5,5,
下面程序的运行结果是:[ ]。fun(int t[],int n){ int i,m;if(n=1) return t[0];elseif(n>=2) {m=fun(t,n-1);return m;}}main(){ int a[]={11,4,6,3,8,2,3,5,9,2};printf("%d\n",fun(a,10));}
若有如下程序: main() {int a=0,t=0; while(!a!=0) t+=a++; printf("%d,%d\n",t,A) ; } 则程序运行后的输出结果是( )A.0,1B.1,0C.0,0D.1,1
有以下程序includemain(){int a=5,b=lt; t=(a 有以下程序 #include<stdio.h> main() { int a=5,b=lt; t=(a<<2)|b;printf("%d\n",t); } 程序运行后的输出结果是______。A.21B.11C.6D.1
有如下程序段struct abc{ int a, b, c, s;};main(){ struct abc s[2]={{1,2,3},{4,5,6}}; int t; t=s[0].a+s[1].b; printf("%d\n",t);}程序运行后输出的结果是A.5 B.6 C.7 D.8
下面程序的运行结果是( )。define EXCH(a,B){int t;t=a;a=b;b=t;}main(){int x=1,y=2;EXCH(x,y);printf("x=%d,y=%d\n",x,y);}
有下列程序 main() { int t, a=1, b=5, c=-2; while(a>b>c) { t=a; a=b; b=t; c++;} printf("%d, %d, %d", a, b, c); } 程序输出的结果是( )。A.1, 5, 0B.1, 5, -2C.5, 1, -1D.5, 1, -2
下面程序的运行结果是#include #define SIZE 12sub(char *a,int t1,int t2) { char ch; while(t1t2) { ch=*(a+t1); *(a+t1)=*(a+t2); *(a+t2)=ch; t1++;t2--; }} main() { char s[SIZE]={’A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’}; int i; sub(s,7,SIZE-1); for(i=0;iSIZE;i++) printf("%c ",s[i]); printf("\n");}
有以下程序: #includestdio.h int f(int t[],int n); main( ) {int a[4]={1,2,3,4},s; s=f(a,4);printf("%d\n",s); int f(int t[],int n) {if(n0)return t[n-1]+f(t,n-1); else return 0; } 程序运行后的输出结果是( )。A.4B.10C.14D.6
有以下程序includevoidfun(int*s,intn1,intn2){inti,j,t; i=n1j=n2; while(i 有以下程序 #include <stdio.h> void fun(int *s,int n1,int n2) { int i,j,t; i=n1 j=n2; while(i<j) {t=s[i];s[i]=s[j];s[j]=t;i++;j--;} } main() { int a[10]={1,2,3,4,5,6,7,8,9,0},k; fun(a,0,3); fun(a,4,9); fun(a,0,9); for(k=0;k<10;k++)printf("%d",a[k]); printf("\n"); } 程序的运行结果是A.987654321B.4321098765C.5678901234D.987651234
有以下程序 main() { int b[3][3]={0,1,2,0,1,2,0,1,2},i,j,t=1; for(i=0;i<3;i++) for(j=i;j<=i;j++)t=t+b[i][b][j][j]]; printf("%d\n",t); } 程序运行后的输出结果是( )A.3B.4C.1D.9
若有如下程序: int s[3] [3]={'a','b','C','d','e','f','g','h','i'},*t; main() {t:(int*)malloc(sizeof(int)); sub(t,s); printf("%c\n",*t); } sub(int*p,int b[][3]) {*p=b[2][1]; } 则程序运行后的输出结果是( )。A.dB.eC.hD.b
单选题有以下程序:#include int f(int t[],int n);main(){ int a[4]={1,2,3,4},s; s=f(a,4); printf(%d,s);}int f(int t[],int n){ if(n0)return t[n-1]+f(t,n-1); else return 0;}程序运行后的输出结果是( )。A4B10C14D6
单选题有以下程序:#include int fun(int n){ static int t=1; int i=1; for(;i=n;i++)t*=i; return t;}main(){ int t=1,i; for(i=2;i4;i++) t+=fun(i); printf(%d,t);}程序的运行结果是( )。A8B11C15D4
单选题有以下程序:#include #include void fun(int*p1,int*s){ int *t; t=(int*)malloc(2*sizeof(int)); *t=*p1+*p1++; *(t+1)=*p1+*p1; s=t;}main(){ int a[2]={1,2}, b[2]={0}; fun(a,b); printf(%d,%d,b[0],b[1]);}程序运行后的输出结果是( )。A2,6B0,0C2,4D1,2