下面两条if语句合并成一条if语句为( )。 if(a<=b) x=1; else y=2; if(a>b) printf("**y=%d\n",y); else printf("##x=%d\n",x);
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); }
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);