更多“程序#includevoidmain(){floata= 11.0,b=3;printf(“% 5.2f\n”,a/b);}执行后的输出结果是()。 ”相关问题
  • 第1题:

    程序includevoidmain(){structss{intx;floaty;}m[2]={10, 5.6,20, 7.8};printf(“% 5.1f\n”,m[0].x*m[1].y);}执行后的输出结果是()。

    A. 78.0

    B. 56.0

    C. 5.6

    D. 7.8


    正确答案:A

  • 第2题:

    程序 include void main( ) { int a=1,b=2,c=3; if(a>b) { if(b>c) c=5; else c-=a; } printf(“%d\n”, c); } 执行后的输出结果是( )

    A.0

    B.2

    C.3

    D.5


    参考答案:C

  • 第3题:

    main() { floatx=123.456; printf("%-5.2f\n",x); } 以上程序输出的结果是_______。

    A.123.4

    B.123.5

    C.123.45

    D.123.46


    正确答案:D
    解析:f格式符,用来输出实数,以小数形式输出。“%-m.nf”的含义是:输出数据共占m列,其中n位小数,如果输出位数小于m,则右端补空格。如果总长度大于列数,则按实际情况四舍五入输出。

  • 第4题:

    程序 include void main( ) { int a=11,b=3; printf(“%d\n”, a/b); } 的输出结果是( )

    A.1

    B.3

    C.11

    D.a= 3.66666


    参考答案:B

  • 第5题:

    main(){ float x=123.456; printf("%-5.2f\n",x);}以上程序输出的结果是______。

    A.123.4

    B.123.5

    C.123.45

    D.123.46


    正确答案:D
    解析:f格式符,用来输出实数,以小数形式输出。“%-m.nf”的含义是:输出数据共占m列,其中n位小数,如果输出位数小于m,则右端补空格。如果总长度大于列数,则按实际情况四舍五入输出。