A program in assembly language to find the largest of 3 numbers – IGNOU MCA Assignment 2015 – 16

By | August 16, 2015

MASTER OF COMPUTER APPLICATIONS

 

Course Code : MCS-017
Course Title : C and Assembly Language Programming(Lab Course)
Assignment Number : MCA(I)/L-017/Assignment/15-16
Maximum Marks : 100
Weightage : 25%

 

Write a program in assembly language to find the largest of 3 numbers. 

 

DATA SEGMENT
NUM1 DB 5
NUM2 DB 9
NUM3 DB 7
LRGT DB ?
ENDS

CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX

MOV AL,NUM1
MOV LRGT,AL
CMP AL,NUM2
JGE SKIP1
MOV AL,NUM2
MOV LRGT,AL
SKIP1:
MOV AL,LRGT
CMP AL,NUM3
JGE SKIP2
MOV AL,NUM3
MOV LRGT,AL
SKIP2:
MOV AH,4CH
INT 21H
ENDS
END START

Program Code :

  1. DATA SEGMENT
  2. NUM1 DB 5
  3. NUM2 DB 9
  4. NUM3 DB 7
  5. LRGT DB ?
  6. ENDS
  7. CODE SEGMENT
  8. ASSUME DS:DATA CS:CODE
  9. START:
  10. MOV AX,DATA
  11. MOV DS,AX
  12. MOV AL,NUM1
  13. MOV LRGT,AL
  14. CMP AL,NUM2
  15. JGE SKIP1
  16. MOV AL,NUM2
  17. MOV LRGT,AL
  18. SKIP1:
  19. MOV AL,LRGT
  20. CMP AL,NUM3
  21. JGE SKIP2
  22. MOV AL,NUM3
  23. MOV LRGT,AL
  24. SKIP2:
  25. MOV AH,4CH
  26. INT 21H
  27. ENDS
  28. END START

Screen shots :-

Asm_program_Largest_in_3_Numbers

Before Execution :

Asm_program_Largest_in_3_Numbers_Output

After Execution :

Asm_program_Largest_in_3_Numbers_Out2