题目内容

请读程序:#include < stdio.h>voidmain(){floatx,y;scanf("%f",&x);if(x<0.0)y=0.0elseif((x<5.0)&&(x!=2.0))y=1.0/(x+2.0);elseif(x<10.0)y=1.0/x;elsey=10.0;printf("%f\n",y);}若运行时从键盘上输入2.0(表示回车),则上面程序的输出结果是

A. 0.000000
B. 0.250000
C. 0.500000
D. 1.000000

查看答案
更多问题

请读程序:#includevoid main(){int x=1,y=0,a=0,b=0;switch(x){ case 1:switch(y){ case 0: a++;break;case 1: b++;break;}case 2:a++;b++;break;}printf("a=%d,b=%d\n",a,b);}上面程序输出结果是

A. a=2,b=1
B. a=1,b=1
C. a=1,b=0
D. a=2,b=0

执行下面语句后的输出为( )int i= -1;if (i < =0)printf("****\n");elseprintf("%%%%\n");

A. ****
B. %%%%
C. %%%%C
D. 有语法错,不能执行

在执行以下程序时,为了使输出结果为t=4,则给a和b输入的值应满足的条件是#includevoid main(){int s,t,a,b;scanf("%d,%d",&a,&b);s=1;t=1;if(a < 0)s=s+1;if(a > b)t=s+1;else if(a= =b)t=5;elset=2*s;printf("t=%d\n",t);}

A. 0 > a > b
B. a=0 < b
C. a=b < 0
D. a < b < 0

若有定义: float w; int a, b; 则合法的switch语句是()

A. switch(w) { case 1.0: printf("*\n"); case2.0: printf("**\n"); }
B. switch(a); { case 1 printf("*\n"); case 2 printf("*\n"); }
C. switch(b) { case 1: printf("*\n"); case 2: printf("*\n"); }
D. switch(a+b); { case 1: printf("*\n"); default: printf("\n"); case 2}

答案查题题库