MARIE instructions for sum of numbers from a to b

671 Views Asked by At

I am new at MARIE simulator and I need to write a code that reads "a" and "b" from the user, and calculates the summation from "a" to "b" and outputs it. Can you please help me with this? This is what i have done but the output is not correct:

ORG 100
Input
Store a
Input 
Store b
Begin, Load a
Store sum
Add one
Store a
Subt b
Skipcond 800
Jump Begin
Output sum
Halt

a, Dec 0
b, Dec 0
one, Dec 1
sum, Dec 0
0

There are 0 best solutions below