Sunday, 13 December 2015

Find the average of three values stored in locations named FIRST, SECOND and THIRD and puts the result in the memory location AVGE

Write a program using 8086 assembly language to find the average of three values stored in locations named FIRST, SECOND and THIRD and puts the result in the memory location AVGE.

Prepared By Hitesh Vataliya

Assembly Program Code

DATA SEGMENT
     FIRST DB 5
     SECOND DB 9
     THIRD DB 7
     AVGE  DB ?
ENDS
CODE SEGMENT   
START:
      MOV AX,DATA
      MOV DX,AX    
      MOV AL,FIRST
      ADD AL,SECOND
      ADD AL,THIRD    
      MOV AH,0    
      MOV DL,3
      DIV DL    
      MOV AVGE,AL          
      MOV AX,4C00H
      INT 21H    
ENDS
END START

No comments:

Post a Comment