I'm trying to output every number that evenly divides the input (so there is no remainder).
For example: if 60 is input, then the output should be:
1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60
I have programmed code that outputs 10 in this example: 50 / 5. But I cannot figure out how to modify this, so that I get every factor. I would appreciate some help!
IN
STO DIVID
IN
STO DIVIS
LOOP1 LDA count
ADD one
STO count
LDA DIVID
SUB DIVIS
STO DIVID
OUT DIVID
BRP LOOP1
HLT
DIVID DAT 000
DIVIS DAT 000
one DAT 001
count DAT 000