Professional Documents
Culture Documents
Computer Architecture11
Computer Architecture11
Computer Architecture11
Output:
Displaying 10 stars **********
.model small
.stack 100h
.data
msg db 10, '**********'
.code
start:
mov ax, @data
mov ds, ax
mov ah, 09h
lea dx, msg
int 21h
Ather Way
.MODEL SMALL
.STACK 100H
.DATA
.CODE
main proc
mov ds, ax
mov ah, 9
lea dx, msg
int 21h
mov cx, 10
mov ah, 2
int 21h
int 21h
main endp
END main
Output:
Factorial 3 is: 6
.MODEL SMALL
.STACK 100h
.DATA
msg db 10,13, "Factorial 3 is: $"
num db 3
res dw 1
.CODE
.STARTUP
mov ax, @DATA
mov ds, ax
fact:
mul bx ; Multiply result by counter
mov bx,ax ; Store result in bx
dec cx ; Decrement counter
cmp cx, 0 ; Compare counter
jnz fact ; If counter not 0 jump to fact
.EXIT
END
Ather Way
factorial calculation;
MOV BX, 1
MOV AX, 1
L1: MUL CL
MOV DX, 0
ADD BX, AX
DEC CL
JNZ L1
printing factorial;
MOV AH, 02h
MOV DL, BX
INT 21h
MOV AH, 4Ch
INT 21h