单项选择题

有以下程序:
#include <stdio.h>
main()
int i;
for(i=0; i<3; i++)
switch(i)
case 0: printf("%d", i);
case 2:printf("%d", i);
default: printf("%d", i);


程序运行后的输出结果是( )。

A) 022111
B) 021021
C) 000122
D) 012
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序: #include <stdio.h> main() char k; int i; for(i=1; i<3; i++) scanf( %c ,&k); switch(k) case '0': printf( another n ); case '1': printf( number n ); 程序运行时,从键盘输入:01<回车>,程序执行后的输出结果是( )。
A) another
number
B) another
number
another
C) another
number
number
D) number
number
单项选择题
在嵌套使用if语句时,C语言规定else总是( )。
A) 和之前与其具有相同缩进位置的if配对
B) 和之前与其最近的if配对
C) 和之前与其最近的且不带else的if配对
D) 和之前的第一个if配对
相关试题
  • p或(p)
  • k
  • 函数fun的功能是:将s所指字符串中下标为偶...
  • j
  • 给定程序中函数fun的功能是:首先把b所指字...