Program in assembly language for factorial of a given number?

1 answer

Answer

1038939

2026-03-16 02:50

+ Follow

INCLUDE Irvine32.inc

.data

num DWord ?

fact DWord 1

str1 DB "Enter a number to Calculate Factorial: ",0

str2 DB "The Factorial is: ",0

.code

main PROC

call clrscr

mov edx,OFFSET str1

call WriteString

call ReadDec

mov num,eax

mov ecx,num

L1 :

mov eax,ecx

mov ebx,fact

mul ebx

mov fact,ebx

LOOP L1

mov edx,OFFSET str2

call WriteString

mov eax,fact

call WriteDec

exit

main ENDP

END main

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.