题目内容

执行下面程序时,若从键盘输入"2",则程序的运行结果是____#include void main( ){ int k; char cp;cp=getchar( );if (cp>='0' && cp<='9')k=cp-'0';else if (cp>='a' && cp<='f')k=cp-'a'+10;else k=cp-'A'+10;printf("%d\n",k);}

A. 10
B. 1
C. 4
D. 2

查看答案
更多问题

运行下面程序时,从键盘输入"2.0",则输出结果是___#include void main( ){ float a,b;scanf("%f",&a);if (a<0.0) b=0.0;else if ((a<0.5) && (a!=2.0)) b=1.0/(a+2.0);else if (a<10.0) b=1.0/2;else b=10.0;printf("%f\n",b);}

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

执行下面程序后,运行结果是_____.#include void main( ){ int x=41,y=1;if (x%3==0 && x%7==0){ y+=x;printf("y=%d\n",y);}else{y=x;printf("y=%d",y);}}

A. y=43
B. y=41
C. y=42
D. y=1

运行下面程序时,从键盘输入"12,34,9",则输出结果是____.#include void main( ){ int x,y,z;scanf("%d,%d,%d",&x,&y,&z);if (x

A. 34
B. 不确定的值
C. 9
D. 12

运行下面程序时,从键盘输入字母H,则输出结果是___#include void main( ){ char ch;ch=getchar( );switch(ch){ case 'H':printf("Hello!\n");case 'G':printf("Good morning!\n");default:printf("Bye_Bye!\n");}}

A. Hello!Good Morning!Bye_Bye!
B. Hello!
C. Hello!Good Morning!
D. Good Morning!

答案查题题库