ASM program to find the factorial of the given number

Aim: – To write an assembly language program to find the factorial of the given number.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(1)
MOV AL, 01
MOV BL, X
LOOK:	MUL BL
DEC BL 
JNZ LOOK
MOV FACT, AL	
END
 
(2)
MOV AL, 01
MOV BL, X
LOOK:	JZ NEXT
MUL BL
JNZ LOOK
NEXT:	MOV FACT, AL	
END
 
(3)
MOV AL, 01
MOV CL, X
LOOK:	JZ NEXT
MUL CL 
LOOP LOOK
NEXT:        MOV FACT, AL	
END

Result: Factorial of a given number is obtained.

Chitra
Chitra

4 thoughts on “ASM program to find the factorial of the given number

  1. please attach the program to find factorial of a number using IDE for ARM controller to my email…..

  2. this is ur requested program to find factorial of a given number…..simulate it on IDE for ARM controller lab purpose.

    (1)
    MOV AL, 01
    MOV BL, X
    LOOK: MUL BL
    DEC BL
    JNZ LOOK
    MOV FACT, AL
    END

    (2)
    MOV AL, 01
    MOV BL, X
    LOOK: JZ NEXT
    MUL BL
    JNZ LOOK
    NEXT: MOV FACT, AL
    END

    (3)
    MOV AL, 01
    MOV CL, X
    LOOK: JZ NEXT
    MUL CL
    LOOP LOOK
    NEXT: MOV FACT, AL
    END

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in