I have been asked to do the following:
Write MARIE code to perform the following program excerpt.
If (x < y + z) {
x = x – y; z=z+1;
}
else y=y-1;
Instructions: - Use “ORG” instruction to start your program at address 200. - The following labels and directives should be included at the end of your program:
X, Dec 4
Y, Dec 2
Z, Dec 5
One, Dec 1
and I wrote this:
ORG 200
Load X
Subt Y
Subt Z
Skipcond 000
Jump Else
If, Load X
Subt Y
Output
Load Z
Add One
Output
Else, Load Y
Subt One
Output
Halt
X, DEC 4
Y, DEC 2
Z, DEC 5
One, DEC 1
my code excutes both if and else conditions. Why is that? and how can I fix it? is the code I wrote correct?