Question: NOTE. Use a 32-bit assembly language programming that can work on x86 processor Write an assembly language program to compute the mean and the variance
NOTE. Use a 32-bit assembly language programming that can work on x86 processor
Write an assembly language program to compute the mean and the variance of the following data at location RAW.
Define Raw data as a WORD. 10, 12, 8, 17, 9, 22, 18, 11,23,7, 30,22,19,6,7
where mean = 1/n (x1 + x2 + +xn)
variance = 1/n { (x1-mean)2 + +(xn mean)2 }
Display MEAN XX VAR YY Note the answers will be INTEGERS.
I was able to calculate the mean and here is my code
; MeanAndVar.asm - adds two 32-bit integers
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
raw sword 10, 12, 8, 17, 9, 22, 18, 11,23,7, 30,22,19,6,7
diff sword 15 DUP(?)
sequare word 15 DUP(?)
.code
main proc
mov edi, OFFSET raw
mov ecx,LENGTHOf raw
mov ax,0
L1:
add ax,[edi]
add edi,TYPE raw
loop L1
mov bl,15
div bl
invoke ExitProcess,0
main endp
end main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
