I need to print all digits of a given number in LMC. I tried with this code who gives me the last digit but I don't know how to keep going with the other digits.
INP
L0 STA R0
SUB R1
BRP L0
LDA R0
OUT
HLT
R0 DAT 000
R1 DAT 010
The code you have will output the least significant digit. To produce the other two digits (knowing that the LMC is limited to 3 digit numbers), first subtract 100 repeatedly and count how many times you could do that: this would be the first digit to output. Then subtract 10 repeatedly and count... and finally output the remainder.
For the repeated subtraction you need a loop. You could consider using self modifying code in order to reuse the same loop for subtracting 100 and later on for subtracting 10. But you might as well write a separate loop for each of these two cases: