Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to find the factorial of a number

Posted By: Rald Fischer     Category: Assembly Language     Views: 35577

Write a program to find the factorial of a number.

Code for Program to find the factorial of a number in Assembly Language

DATA SEGMENT
A DB 5
DATA ENDS
CODE SEGMENT
         ASSUME DS:DATA,CS:CODE
START:
      MOV AX,DATA
      MOV DS,AX
      MOV AH,00
      MOV AL,A
 L1:  DEC A
      MUL A
      MOV CL,A
      CMP CL,01
      JNZ L1
      MOV AH,4CH
      INT 21H 
CODE ENDS
END START

;OUTPUT:->
;-G CS: 001B
;
;AX=0078  BX=0000  CX=0001  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=001B   NV UP EI PL ZR NA PE NC
;0BA9:001B B44C          MOV     AH,4C
  
Share: 


Didn't find what you were looking for? Find more on Program to find the factorial of a number Or get search suggestion and latest updates.

Rald Fischer
Rald Fischer author of Program to find the factorial of a number is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Ankit Gosar from India Comment on: Sep 29
Hi,
I am not able to find the code for Finding The Factorial Of A Number Using Recursive Method in assembly language and also its output. So please can anyone provide a program for this... ??

View All Comments