Solved programming problem

Find Factorial of a Number in Assembly with Recursion.

Source code

org 100h

     

.data

  c db ?

.code

   main proc

   

    mov ax,5

    call fx

         

ret

   endp ;end main

 

   fx proc

   

    cmp ax,1

    jle base

    jmp recursive

   

   

    base:     ;base case

     

       mov bx,1

       ret

     

    recursive:

   

    push ax ;save current value in stack

   

    dec ax  ;n--

   

    call fx     ; recursive call

   

    pop ax      ; get the value of ax

   

    mul bx      ; ax*bx

    mov bx,ax   ; move new ax value to bx

         

 

    ret

   

   endp

Output


Output:

 

Join the discussion

Add your comment

3 previous comments

Nuansilia

<a href=https://tamoxifenolvadex.com/>tamoxifen withdrawal symptoms</a> The client should continue to perform monthly breast self-examinations even when receiving yearly mammograms.

Mellelogs

So don t give up - there are all sorts of ways to get children - and you do love them just as much as your biological. <a href=https://clomida.com/>what does clomid do for men</a>

Tiegree

[url=https://newfasttadalafil.com/]Cialis[/url] Bcmzcp Treatment for BP lower than these values is controversial. Ntminn <a href=https://newfasttadalafil.com/>Cialis</a> Uidqkg https://newfasttadalafil.com/ - Cialis Viagra Ready Man