Question: Assembly Lang. INCLUDE Irvine32.inc .data prompt1 BYTE Please Enter Number: , 0 val1 DWORD ? .code main proc mov edx, offset prompt1 call WriteString call
Assembly Lang.
INCLUDE Irvine32.inc
.data
prompt1 BYTE "Please Enter Number: ", 0
val1 DWORD ?
.code
main proc
mov edx, offset prompt1
call WriteString
call readInt
mov val1, eax
call Crlf
push val1
call Factorial
call WriteDec
call crlf
invoke ExitProcess,0
main endp
Factorial PROC
push ebp
mov ebp,esp
mov eax,[ebp+8]
cmp eax,0
ja L1
mov eax, 1
jmp L2
L1: dec eax
push eax
call Factorial
returnFac:
mov ebx,[ebp+8]
mul ebx
L2: pop ebp
ret 4
Factorial ENDP
end main
- What will happen to the Factorial programs output when you try calculate 13! And why?
- How many bytes of stack space will be used by the Factorial subroutine when calculating 3!?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
