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.

5 Responses to “ASM program to find the factorial of the given number”

  1. praveenkumar

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

    Reply
  2. praveenkumar

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

    Reply
  3. Profile photo of praveenkumar

    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

    ReplyReport user
  4. tabudlong gemmarey

    there’s an error between this line, MOV BL, X is not recognized by the emulator

    Reply

Leave a Reply