有以下程序段,若变量已正确定义并赋值 if(a>b)printf("x=%d,", x); else printf("y=%d,", y); if(a

admin2020-07-28  38

问题 有以下程序段,若变量已正确定义并赋值
if(a>b)printf("x=%d,", x);
else printf("y=%d,", y);
if(a<=b)i++;
else j++;
则与此程序段功能相同的选项是( )。

选项 A、if(a>b){printf("x=%d,", x);j++;}
else {printf("y=%d,", y);i++;}
B、if(a>b){printf("x=%d,", x);i++;}
else {printf("y=%d,", y);j++;}
C、if(a<=b){printf("x=%d,", x);i++;}
else {printf("y=%d,", y);j++;}
D、if(a>=b){printf("x=%d,", x);i++;}
else {printf("y=%d,", y);j++;}

答案A

解析 程序的逻辑是当a>b时,执行语句"printf("x=%d, ", x);"和语句" j++;",否则执行语句"printf("y=%d, ",y);"和语句"i++;",由此答案选A。
转载请注明原文地址:https://kaotiyun.com/show/Qn3p777K
0

相关试题推荐
随机试题
最新回复(0)