- #1
cduval04
- 1
- 0
Homework Statement
trying to write a program for school. the program is supposed to do the following:
Write a program that takes an input value (for example, a number 5). The output should be sum of all numbers from 1 to the value input by the user (in this example, the output would be 1+2+3+4+5 i.e. 15)
what I don't get is how if say I enter 20 how to get it to know that I entered 20 and just add all the numbers from 1 to 20 like count. would I use the SUB (subtract) command to aid in this? help-I'm stuck!
Homework Equations
The Attempt at a Solution
INP
STA NUM1
LDA NUM1
INP
STA NUM2
LDA NUM2
ADD NUM2
OUT
HLT