Robert_JR

Factorial

Apr 19th, 2017
92
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.     ;----if i want to print the result ( less than 10 )---
  22.     mov ah,2    
  23.     mov dx,ax    
  24.     add dx,30h
  25.     int 21h  
  26.     ;-------------
  27.    
  28.     main endp
  29. end main
Add Comment
Please, Sign In to add comment