Let's start by breaking this down. First of all, I assume that the following section is defining some integers:
!temp a,,i2
!temp b,,i2
!temp c,,i2
!temp i,,i2
Next, you are assigning values to them (and I assume that your initial use of
temp
is a mistype, as you change this to
tmp
further on). So, you set
b
to 5 and
a
to 2; then you subtract a from b and store that in c, so
c
is 3. This means that your if test drops into the
tmp.b = 7
section. Following the rest of the logic,
tmp.b
isn't used anywhere else, and leads to a real logic bomb for you if you expect your
while
condition to execute.
What is the bomb? Well, assuming your logic is entirely correct, your
for
test loops from 0 to 2, so you never execute the inner logic of the while loop because
tmp.i
never reaches the condition where it will trigger. This means that
tmp.i
stops at 2, and that leads to the value you are returning.
You could have figured all this out for yourself just by writing it out. It's not that hard to work through a problem as simple as this.