vendredi 27 juillet 2018

Why is my output not showing up in the if statement pseudocode?

i have researched the threads but i couldn't quite get this pseudocode to work:

Input 9 as a value for x
if(x < y)
min= x;
else
min=y;
Output the value of min

this is what i wrote:

ORG 300
    INPUT
    STORE X
    IF,     LOAD Y
    SUBT X
    SKIPCOND 000
    JUMP THEN
    THEN,   LOAD min
    ADD X
    STORE min
    LOAD min
    ELSE,   LOAD min
    ADD Y
    STORE min
    LOAD min
    OUTPUT
    X, Dec 0
    Y, Dec 5
    min, Dec 0

i have put the input as 9 in dec. the output shows up as 14 and i don't know where i went wrong. please bare with me as this is the first time ive ever used the marie sim software.

Thanks.

Aucun commentaire:

Enregistrer un commentaire