Saturday, April 30, 2016

8051 Program – factorial of a given number

; factorial of a given number
; input:R0
; output: BA
ORG 0H
MAIN:
MOV R0,#05 ;Input number
MOV A,R0
LCALL FACT
SJMP $
FACT: CJNE R0,#01,loop
RET
loop: DEC R0
MOV B,R0
MUL AB
LJMP FACT
END



Related topics:
8051 Program - smallest element in an array   |   8051 Program - largest element in an array   |   8051 Program - fibonacci series   |   8051 Program - lcm of two numbers   |   8051 Program - gcf of two numbers   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment