Advertisement
Guest User

Factorial

a guest
Apr 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .stack 100h
  2. .model small
  3. .data            
  4.     n dw 3
  5. .code
  6.  
  7. main proc
  8.    
  9.     mov ax,@data
  10.     mov ds,ax
  11.    
  12.     mov cx,n
  13.     dec cx
  14.     mov ax,n
  15.    
  16.     fact:
  17.         dec n
  18.         mul n
  19.         loop fact      
  20.        
  21.     mov ah,2    
  22.     mov dx,ax    
  23.     add dx,30h
  24.     int 21h  
  25.    
  26.     main endp
  27. end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement