Question

Write an assembly program which prints the largest values among three variables. You can initialize three...

Write an assembly program which prints the largest values among three variables. You can initialize three integers in data section (let's say 10, 45, 15).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Assembly program which prints the largest values among three variables : -

Here, we use N1,N2 & N3 for storing three variables. And, LRG for storing largest number among them.

Code:-

DATA SEGMENT
N1 DB 10H
N2 DB 45H
N3 DB 15H
LRg DB ?
ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AL,N1
MOV LRG,AL
CMP AL,N2
JGE LABEL1
MOV AL,N2
MOV LRG,AL
LABEL1:
MOV AL,LRG
CMP AL,N3
JGE LABEL2
MOV AL,N3
MOV LRG,AL
LABEL2:
MOV AH,4CH
INT 21H
ENDS
END START

--------------------------------------------------------------------------------

Screenshots:

Before Execution :

After Execution :

Now , you can see LRG variable has the largest.

(I have used 8086 emulator).

------------------------------------------------------------------------------------------------------------------------------------------------------

Please give your valuable feedback and also rate my efforts.

Thank You

Add a comment
Know the answer?
Add Answer to:
Write an assembly program which prints the largest values among three variables. You can initialize three...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT