Write a LMC assembly program that finds the smallest value o
Write a LMC assembly program that finds the smallest value of three integer numbers. Thee integer numbers will be provided by the user through keyboard and the smallest value is identified and then printed on the console screen. The sample outputs are 3, 5, and 10. The output should be 3. The code below is what I have so far.
Solution
Hi
Here is the program for finding the smallest number in three given numbers
INP
STA FIRST
INP
STA SECOND
INP
STA THIRD
SUB FIRST
BRP SMALLER
LDA FIRST #IN THIRD AND FIRST, FIRST IS SMALLER
SUB SECOND
BRP SMALLER
LDA FIRST #IN SECOND AND FIRST, FIRST IS SMALLER
LDA SECOND
SUB THIRD
LDA SECOND #IN SECOND AND THIRD, SECOND IS SMALLER
BRA DONE
SMALLER LDA FIRST
DONE OUT
HLT
FIRST DAT
SECOND DAT
THIRD DAT
Hope this might help you , Happy Chegging .
