Rather than creating one big equation to define “k” at the end I suggest that you just do the computation in order, just as the computer would. So it would be “x” which, when it is defined, is 9, minus “i” which was 2 but has been redefined to be “x-i-j”, so when the final “k” is computed, “i” is 4, and then minus “k” which during the final defining of “k” it is 4. Therefore, the output of “k” is (9 - 4 - 4 = 1).
When in doubt, try to think through it like the computer would.
Hope this cleared it up.