• 2022-06-03
    下面两条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

    举一反三

    内容

    • 0

      以下程序的输出结果:______________#include "stdio.h"int main(){ int x,y,z; x=1; y=2; z=3; if(x &gt; y) if(x &gt; 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); }