How can I get this code to calculate 5 factorial and store it in the variable 'ans'? .data i DWORD 5h j DWORD 1h ans DWORD ? .code main proc mov eax,i mov ecx,5h L1: mul eax sub ecx,j mov ans,eax loop L1
How can I get this code to calculate 5 factorial and store it in the variable 'ans'?
.data
i DWORD 5h
j DWORD 1h
ans DWORD ?
.code
main proc
mov eax,i
mov ecx,5h
L1: mul eax
sub ecx,j
mov ans,eax
loop L1

Program
Address MNEMonics COMMENTS
0400 MOV CX, [0500] CX <- [0500]
0404 MOV AX, 0001 AX <- 0001
0407 MOV DX, 0000 DX <- 0000
040A MUL CX DX:AX <- AX * CX
040C LOOP 040A Go To [040A] till CX->00
0410 MOV [0600], AX [0600]<-AX
0414 MOV [0601], DX [0601]<-DX
0418 HLT Stop Execution
Step by step
Solved in 4 steps









