题目内容

Perform the following procedure, input 3 and the output is ( ). #include “stdio.h” main() { int k; scanf(”%d”, &k); switch(k) { case 1: printf(”%d\n”, k++); case 2: printf(”%d\n”, k++); case 3: printf(”%d\n”, k++); case 4: printf(”%d\n”, k++); break; default: printf(”Full!\n”); }}

A. 3
B. 4
C. 34
D. 44

查看答案
更多问题

while and do while statements have the same function.

Three expressions in the for loop statement, omitting the second expression indicates that the loop condition is true.

When executing the following segments ( ) x=-1; do {x=x*x;} while (!x);

A. Loop body will execute once
B. The loop body will execute twice
C. The loop body will execute many times
D. You will be prompted for a syntax error

main() {int s=0,a=1,n; scanf(“%d”,&n); do {s+=1;a=a-2;} while(a!=n); printf("%d\n”,s); }If you want the output value of the program to be 2, the value you should enter for n from the keyboard is ( ).

A. –1
B. –3
C. –5
D. 0

答案查题题库