Write a Marie Assembly language program that takes integers at inputs and return
ID: 3682718 • Letter: W
Question
Write a Marie Assembly language program that takes integers at inputs and returns the sum of the negative numbers and the sum of the positive numbers. For example: the user should be prompted to enter numbers one at a time followed by hitting enter and then when they are done they should type '0' indicating that they are done entering values. The program should add up all the numbers that are> 0 and all the numbers that are < 0. for example, if the user inputs: 5,6,-1 the program should return positive sum = 11 negative sum = -1 (this is all using the marie simulator)
This is what I have so far and needs to be in a similar format as the one below, I know this code isn't right but pointing out the flaws and showing how they would be fixed would help me so much!
clear
while, load x
skipCond 400
jump, End_while
if, skip Cond 800
jump, else
load NegativeSum
end_if, add x
else, load PositiveSum
end_else, add x
End_While, output, PositiveSum, NegativeSum
Halt
PositiveSum dec 0
NegativeSum dec 0
Explanation / Answer
The above program is somewhat correct but the flaws are
skipcond 400
jump
for which location it has to jump you have to specify the label along with the condition what it has to do.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.