Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.
User Input INP
Store Input STA TEST
Start + Load Second START LDA SECOND
Subtract Test SUB TEST
Initiate Loop BRP GREATER
Initiate Loop BRZ EQUAL
Initiate Loop BRZ END
Define + Load second GREATER LDA SECOND
Add to First ADD FIRST
Save as Next STA NEXT
Load Second LDA SECOND
Save as First STA FIRST
Load Next LDA NEXT
Save as Second STA SECOND
Load Counter LDA COUNTER
Add to Value ADD INCREM
Save as Counter STA COUNTER
Close Loop BRA START
Define + Load Second EQUAL LDA COUNTER
Output OUT
Stop HLT
Stop END HLT
Define Test = 0 TEST DAT 000
Define First = 1 FIRST DAT 001
Define Next = 0 NEXT DAT 000
Define Second = 1 SECOND DAT 001
Set Counter = 2 COUNTER DAT 002
Set Increment 1 INCREM DAT 001
User Input INP
Store Input STA TEST
Start + Load Second START LDA TEST
Subtract Test SUB SECOND
Initiate Loop BRP GREATER
Initiate Loop BRZ EQUAL
Define + Load second GREATER LDA SECOND
Add to First ADD FIRST
Save as Next STA NEXT
Load Second LDA SECOND
Save as First STA FIRST
Load Next LDA NEXT
Save as Second STA SECOND
Load Counter LDA COUNTER
Add to Value ADD INCREM
Save as Counter STA COUNTER
Close Loop BRA START
Define + Load Second EQUAL LDA COUNTER
Output OUT
Stop HLT
Stop END HLT
Define Test = 0 TEST DAT 000
Define First = 1 FIRST DAT 001
Define Next = 0 NEXT DAT 000
Define Second = 1 SECOND DAT 001
Set Counter = 2 COUNTER DAT 002
Set Increment 1 INCREM DAT 001
INP
STA TEST
START LDA TEST
SUB SECOND
BRZ EQUAL
BRP GREATER
BRA END
GREATER LDA SECOND
ADD FIRST
STA NEXT
LDA SECOND
STA FIRST
LDA NEXT
STA SECOND
LDA COUNTER
ADD INCREM
STA COUNTER
BRA START
EQUAL LDA COUNTER
OUT
HLT
END HLT
TEST DAT 000
FIRST DAT 001
NEXT DAT 000
SECOND DAT 001
COUNTER DAT 002
INCREM DAT 001
INP
STA TEST
START LDA TEST
SUB SECOND
BRZ EQUAL
BRP GREATER
BRA END
GREATER LDA SECOND
ADD FIRST
STA NEXT
LDA SECOND
STA FIRST
LDA NEXT
STA SECOND
LDA COUNTER
ADD INCREM
STA COUNTER
BRA START
EQUAL LDA COUNTER
OUT
HLT
END LDA ZERO
OUT
HLT
TEST DAT 000
FIRST DAT 001
NEXT DAT 000
SECOND DAT 001
COUNTER DAT 002
INCREM DAT 001
ZERO DAT 000
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.