请给我这个问题的答案 [英] Please give me the answer for this question

查看:56
本文介绍了请给我这个问题的答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

What is the value of m after the following code fragment is executed ?

a=2;
b=2;
c=4;

if(a>b) then
    if(a>c) then
    m=1
else
    m=2
end if
Else
if(c<>0) then
    m=3
else
    m=4
end if
end if

推荐答案

答案是m = 3.



从顶部开始向前走。 a和b设置为2.c设置为4.



a是否大于b(2大于2)?没有。转移到其他地方。



c不等于零(3不等于0)?是。按照当时的说法。



m设置为3.



如果代码标签有点不同它可能更容易遵循if / then / else流程。
The answer is m = 3.

Start at the top and work your way down. a and b are set to 2. c is set to 4.

Is a is bigger than b (2 bigger than 2)? No. move to the else.

Is c not equal to zero (3 not equal to 0)? Yes. Follow the then.

m is set to 3.

If the code was tabbed a bit differently it might be easier to follow the if/then/else flows.


这篇关于请给我这个问题的答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆