You are on page 1of 2

Register No.

: 20BCE1477 Name: RAMINEDI SANTHOSH

Date: 19/01/2022 Exp: 2 Sum and Average of an array

Aim:

To calculate sum and average of an array

Tool Used:

Assembler - MASM 611

Algorithm:
1. NUM1 array is initialized in data segment and values are assigned.
2. Moving elements of an array in data register and performing sum using loop.
3. Sum of elements is stored in AX register and performing division operation with no of
elements in array and quotient result is stored in AL and remainder is stored in AH
register.
4. End of the program.

Program:
Register No.: 20BCE1477 Name: RAMINEDI SANTHOSH

Sample Input:
Data segment Num1 array consists of elements: 3H, 5H, 7H, 4H, 2H

Sample Output:
Sum of elements of the NUM1 Array is 15H (21 in decimal).

Average of the elements is stored in AX register. AL contains quotient of value 4H and AH


contains remainder of value 1H.

Register/ Memory Contents for I/O:

Snapshot of the Output:

Result:

Sum and Average of an array is calculated using masm assembler.

You might also like