成人高等教育 / C语言程序设计
正确率:100%
有以下程序,程序运行以后的输出结果是()
#include ""stdio.h""
main( )
{ int a[ ]={2,3,5,4},i;
for(i=0;i<4;i++)
switch(i%2)
{ case 0:switch(a[i]%2)
{case 0:a[i]++;break;
case 1:a[i]--;
}break;
case 1:a[i]=0;
}
for(i=0;i<4;i++) printf(""%d "",a[i]);
printf(""\n"");
}
#include ""stdio.h""
main( )
{ int a[ ]={2,3,5,4},i;
for(i=0;i<4;i++)
switch(i%2)
{ case 0:switch(a[i]%2)
{case 0:a[i]++;break;
case 1:a[i]--;
}break;
case 1:a[i]=0;
}
for(i=0;i<4;i++) printf(""%d "",a[i]);
printf(""\n"");
}
- A、 3 3 4 4
- B、 2 0 5 0
- C、 3 0 4 0
- D、 0 3 0 4
参考答案: