Question: Write a program in assembly language that will - take ten integers (32 bit) in an array - add up the elements - calculate the

Write a program in assembly language that will - take ten integers (32 bit) in an array - add up the elements - calculate the integer average - print out the integers and the resulting sum and average Use the following set of integers (in decimal): 14 -32 0 7 42 -20 18 300 -123 -6

No Loops!!

This is my code so far, i'm having troube with the division part. Output should show 200 and 20 respectivley.

INCLUDE Irvine32.inc

.data myArray DWORD 10 DUP (?) Sum DWORD ?

.code Main PROC call Clrscr

call ReadInt mov[myArray+0],eax call ReadInt mov[myArray+4],eax call ReadInt mov[myArray+8],eax call ReadInt mov[myArray+12],eax call ReadInt mov[myArray+16],eax call ReadInt mov[myArray+20],eax call ReadInt mov[myArray+24],eax call ReadInt mov[myArray+28],eax call ReadInt mov[myArray+32],eax call ReadInt mov[myArray+36],eax

mov eax,0 add eax,[myArray+0] add eax,[myArray+4] add eax,[myArray+8] add eax,[myArray+12] add eax,[myArray+16] add eax,[myArray+20] add eax,[myArray+24] add eax,[myArray+28] add eax,[myArray+32] add eax,[myArray+36]

mov Sum,eax call WriteInt call CRLF

mov eax,ecx mov ebx,10 xor edx,edx div ebx call WriteInt call CRLF

exit main ENDP

END main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!