I am making a program that allows a user to input numbers indefinitely until they input '0'. Once they enter 0 the program should halt. However, I want to add each number entered to a running total and output the total everytime the user inputs a new number. For example:
Input = 2
Total = 2
Input = 2
Total = 4
Input = 3
Total = 7
Input = 0
Program stops
Code:
START INP
ADD TOTAL
OUT
BRA START
HLT
TOTAL DAT 000
The code above takes user input indefinitely but outputs single numbers (Does not keep a running total). I am wondering how I would keep a running total of all numbers entered and also stop the program when the user enters 0 in LMC. Thanks in advance.