A: if(a<=b){ x=1; printf("
B:
C: x=%d\n",x); } else{ y=2; printf("**y=%d\n",y); }
D: if(a<=b) x=1; printf("
E:
F: x=%d\n",x); else y=2; printf("**y=%d\n",y);
G: if(a<=b){ x=1; printf("**y=%d\n",y); } else{ y=2; printf("
H:
I: x=%d\n",x); }
J: if(a>b){ x=1; printf("
K:
L: x=%d\n",x); } else{ y=2; printf("**y=%d\n",y); }
举一反三
- 以下二条if语句可合并成一条if语句为______ 。 if(a<=b)x=1; else y=2; if(a>b)printf(“****y=%d\n”,y); else printf(“####x=%d\n”,x);
- 选择出合法的if语句(设intx,y;)()。 A: if(x!=y)if(x>y)printf("x>y\n"); else printf("x<y\n"); elseprintf("x==y\n"); B: if(x!=y) if(x>y)printf("x>y\n") else printf("x<y\n"); else printf("x==y\n"); C: if(x!=y)if(x>y)printf("x>y\n"); else printf("x<y\n") else printf("x==y\n"); D: if(x!=y) if(x>y) printf("x>y\n"); else printf("x<y\n") else printf("x= =y\n");
- a为非零时显示x,为零时显示y。能完成该功能的语句是 ( ) 。 A: if(a) printf("%d\n",x); else printf("%d\n",y); B: if(!a) printf("%d\n",y); else printf("%d\n",x); C: if (a!=0) printf("%d\n",x); else printf("%d\n",y); D: if(a==0) printf("%d\n",y); else printf("%d\n",x); E: if(a) printf("%d\n",x); else; printf("%d\n",y);
- 下列条件语句中,输出结果与其他语句不同的是 A: if(a)printf("%d\ n",x);else printf("%d\n",y); B: if(a==0)printf("%d\n",y);else printf("%d\n",x); C: if(a!=0)printf("%d\ n",x);else printf("%d\n",y); D: if(a==0)printf("%d \n",x);else printf("%d\n",y);
- 10.下列条件语句中,功能与其他语句不同的是______。 A: if(a) printf("%d\n",x); else printf("%d\n",y); B: if(a==0) printf("%d\n",y); else printf("%d\n",x); C: if (a!=0) printf("%d\n",x); else printf("%d\n",y); D: if(a==0) printf("%d\n",x); else printf("%d\n",y);
内容
- 0
以下程序的输出结果:______________#include "stdio.h"int main(){ int x,y,z; x=1; y=2; z=3; if(x > y) if(x > z) printf("%d",x); else//注意else匹配的if printf("%d",y); printf("%d\n",z);}
- 1
阅读下面程序,则执行后的输出结果是______。 #include"stdio.h" main() int x, y, 2; x=1; y=2; z=3; if(x>y)if(x>z)printf("%d", x); else printf("%d", y); printf("%d\n",z);
- 2
若有float x; int a,b; ,下面四条switch语句中正确的有( )条。 switch(x) { case x=1.0: printf(“Y”); case x=2.0: printf(“N”); } switch(a) { case a=1: printf(“Y”); case a=2: printf(“N”); } switch(b) { case b==1: printf(“Y”); case b==2: printf(“N”); } switch(x) { case 1.0: printf(“Y”); case 2.0: printf(“N”); }
- 3
(4)()#include()extern()serial_initial()();()main()(){()int()a,b();()unsigned()int()x,y();()serial_initial()();()a=b=0xaa55();x=y=0xaa55;()printf("\n()a=%4x()b=%4x()x=%4x()y=%4x",a,b,x,y)();()a=a<<1();b=b>>1;()x=x<<1();y=y>>1;()printf("\n()a=%4x()b=%4x()x=%4x()y=%4x",a,b,x,y)();()printf("\n")();()printf("\n")();()printf("That()is()all.\n")();()while(1)();()}()______________________________________________________________________________________________________________________________
- 4
以下程序的运行结果是。 voidmain() {intx=2,y=2; if(x<0) y=0; elseif(x<100) y=10/x; else y=1; printf("%d\n",y); }