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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started