Google

Sep 26, 2008

Program to find arithmetic mean of n numbers

Program to find arithmetic mean of n numbers


CLC ; clear carry flag
MOV SI , 2000
MOV DI, 2050
MOV CX, 0000 ; Load CX register with the value given by 0000
MOV AX,0000
MOV CL,[SI]
MOV DL,CL
A1: INC SI ; Increment SI contents
ADD AL,[SI] ; ADD AL with the value given by that at SI and store in AL
LOOP AI ( 1011) ; Repeat until CX=0
DIV BL; Divide AX With the value given by BL
MOV [DI],AX ; Load the value in AX into as location at DI
INT A5 ; HALT

Thus with the above code the arithmetic mean of n numbers can found accordingly.

sample input:
0000:2000 array size
0000:20001 array elements
from 2001 location

Output
0000:2050 Result


You might be also interested in:

::Interfacing pic microcontroller with LCD
:: Serial Port interfacing with atmega
:: TCP/IP on PIC 18 series

2 comments:

jhony112 said...

plese hep me i need a program to find the average of n scores...i have the code for a single digit number i.e 1,2 but i need that to collect a score like 45,78 etc..pls help

jhony112 said...

please hep me i need a assembly lang program to find the average of n scores...i have the code for a single digit number i.e 1,2 but i need that to collect a score like 45,78 etc..pls help