2000万题库,覆盖所有考试类目,免费查题
今日已更新 14570 道题
2023-10-23 88次 计算机二级 反馈错误 加入收藏 正确率 : 100%
main
{ int a=2,b=-1.c=2;
if(a<0)if(b<0)c=0;
else c++;
printf("%d\n",c);
}
该程序的输出结果是( )。
A.0
B.1
C.2
D.3
王老师
回答题目:2621条
else与离它最近的if构成if…else语句,而当a为2时,第一个if语句不成立,因此什么也不做,即c 的值仍然为2,故选择C选项。
(备注:部分简单试题没有解析)
本题链接: https://www.chengdubuxi.cn/zyks/z081.html