i'm really struggling with this pseudocode to convert it to MARIE

   Input a number 
    Assign this number to x 
if(x <y) 
x = x + y; 
 z=z+w; 
else  
 y=y-w; 

Print the value of the accumulator.

x, Dec 0
y, Dec 2
z, Dec 5
w, Dec 1

Recommended Answers

All 2 Replies

This reads like a typical assignment so I'll only note that I would definitely use the JUMP ELSE somewhere in my solution.
Again, I can't provide code since that would be doing your homework.

commented: Load x Subt y Skipcond 800 Jump Else If, Load x Add y Store x Output x Clear Laod z add w store z Output z Else, Load y subt w store y +0

is this correct

Load  x
Subt  y
Skipcond 800
Jump Else
If,    Load x
Add  y
Store x
Output x
Clear  
Laod z
 add   w
store z
Output z 
Else,  Load y
subt w
store y
commented: I am not a machine or run code. Test it out but that's the idea. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.