[Assembly Language] SUMMING ELEMENTS IN AN ARRAY
1. Assign the array’s address to a register that will serve asan indexed operand.
2. Initialize the loop counter to the length of the array.
3. Assign zero to the register that accumulates the sum.
4. Create a label to mark the beginning of the loop.
5. In the loop body, add a single array element to the sum.
6. Point to the next array element.
7. Use a LOOP instruction to repeat the loop
Answer
; Which assembler to use was not specified in the question
; so using Nasm
; Commands:
; nasm -felf32 sum_array.asm
; gcc -m32 sum_array.o
;
OR
OR