;Program to find out factorial of number in 8086 assembly language

data segment

number dw 04h

ends

stack segment

dw 128 dup(0)

ends

code segment

assume cs:code, ds:data

start:

; set segment registers:

mov ax, data

mov ds, ax

mov cx,number

call fact

mov ax, 4c00h ; exit to operating system.

int 21h

;procedure for factorial program

;assume cx contains input number

;assume Dx contains result

fact proc near

cmp cx, 01h

jne cont

mov dx,01h

ret

cont: push cx ; for backup

dec cx

call fact

pop ax ; backup of cx ie n

mul dx ; n*(n-1)!

mov dx, ax ; result into dx

ret

fact endp

ends

end start ; set entry point and stop the assembler.

data segment

number dw 04h

ends

stack segment

dw 128 dup(0)

ends

code segment

assume cs:code, ds:data

start:

; set segment registers:

mov ax, data

mov ds, ax

mov cx,number

call fact

mov ax, 4c00h ; exit to operating system.

int 21h

;procedure for factorial program

;assume cx contains input number

;assume Dx contains result

fact proc near

cmp cx, 01h

jne cont

mov dx,01h

ret

cont: push cx ; for backup

dec cx

call fact

pop ax ; backup of cx ie n

mul dx ; n*(n-1)!

mov dx, ax ; result into dx

ret

fact endp

ends

end start ; set entry point and stop the assembler.

Role of Parser

ReplyDeleteFlat Panel Display

Naming Distributed system

Conversion from NFA to DFA (Thompson’s rule)

virtual mode 80386

time shared common bus

mapping cardinality

rsa algorithm