Program To Find Factorial Of any no ~ Assembly language
include irvine32.inc
.data
msg byte "Please enter a number: ",0,13h,10h
num dword ?
fact dword 1
.code
main proc
call clrscr
call crlf
mov edx,offset msg
call writestring
call readint
mov num,eax
mov ecx,num
mov ebx,1
D2:
mov eax,fact
mul ebx
mov fact,eax
inc ebx
loop D2
call crlf
mov eax,fact
call writeint
exit
main endp
end main
.data
msg byte "Please enter a number: ",0,13h,10h
num dword ?
fact dword 1
.code
main proc
call clrscr
call crlf
mov edx,offset msg
call writestring
call readint
mov num,eax
mov ecx,num
mov ebx,1
D2:
mov eax,fact
mul ebx
mov fact,eax
inc ebx
loop D2
call crlf
mov eax,fact
call writeint
exit
main endp
end main
Post a Comment