Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » GeneralRSS Feeds

Program to Calculate the average of n numbers

Posted By: Chloe Brown     Category: Assembly Language     Views: 25054

A program to Calculate the average of n numbers.

Code for Program to Calculate the average of n numbers in Assembly Language

.MODEL SMALL
.DATA
        VAL1    DB      ?
        NL1     DB      0AH,0DH,'ENTER HOW MANY NO U WANT:','$'
        NL2     DB      0AH,0DH,'ENTER NO:','$'
        NL3     DB      0AH,0DH,'AVEARGE:','$'
.CODE
MAIN    PROC
        MOV AX,@DATA
        MOV DS,AX

        LEA DX,NL1
        MOV AH,09H
        INT 21H

        MOV AH,01H
        INT 21H
        SUB AL,30H

        MOV CL,AL
        MOV BL,AL
        MOV AL,00
        MOV VAL1,AL

LBL1:
        LEA DX,NL2
        MOV AH,09H
        INT 21H

        MOV AH,01H
        INT 21H
        SUB AL,30H

        ADD AL,VAL1
        MOV VAL1,AL
        LOOP LBL1

LBL2:
        LEA DX,NL3
        MOV AH,09H
        INT 21H

        MOV AX,00
        MOV AL,VAL1
        DIV BL
        ADD AX,3030H
        MOV DX,AX
        MOV AH,02H
        INT 21H

        MOV AH,4CH
        INT 21H

MAIN    ENDP
        END     MAIN



OUTPUT
************

Z:\SYSTEM~1\AS1>ex11

ENTER HOW MANY NO U WANT:3
ENTER NO:3
ENTER NO:3
ENTER NO:3
AVEARGE:3
  
Share: 


Didn't find what you were looking for? Find more on Program to Calculate the average of n numbers Or get search suggestion and latest updates.

Chloe Brown
Chloe Brown author of Program to Calculate the average of n numbers is from London, United Kingdom.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Henry Nnaike from United States Comment on: Jan 17
Hello, this program can only accept just one problem, please can I get one that uses a buffer?

View All Comments