Question: : given an array of doubleword integers, (1) find their i and (2) add 10 to each number smaller than average ; author: R. Detmer

 : given an array of doubleword integers, (1) find their i
and (2) add 10 to each number smaller than average ; author:

: given an array of doubleword integers, (1) find their i and (2) add 10 to each number smaller than average ; author: R. Detmer : revised: 6/2013 ave 586 MODEL FLAT .STACK 4096 . DATA nbrArray DWORD 25, 47, 15, 50, 32, 95 DUP (?) nbrElts DWORD 5 CODE main : find sum and average PROC sumO eax, 0 ebx, nbrArray mov get address of nbrArray ; count : nbrElts i quit if no numbers ; add number to sum : get address of next array elt : repeat nbrElts times mov ecx, nbrElts jecxz qui forCountl: add eax, [ebx] add ebx,4 loop forCount1 cdq idiv nbrElts ; extend sum to quadword : calculate average : add 10 to each array element below average lea ebx, nbrArray mov ecx,nbrElts jnl endIfSmall add DWORD PTR [ebx], 10 ; get address of nbrArray ; count := nbrElts : number average ? : continue if not less forcount2: ebx], eax add 10 to number endIfSmall add ebx,4 loop forcount2 i get address of next array elt i repeat ; exit with return code o mov eax, 0 ret ENDP quit: main END Figure 5.9

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!