fibonacci - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!



narisma20narisma20 Posts: 1Member
[b][red]This message was edited by narisma20 at 2006-1-5 23:35:48[/red][/b][hr]
would you please send to my email add the sample code of the fibonacci program using assembly language. tnx
[email protected]


  • DipaleeDipalee Posts: 11Member
    I m not writting exact assembly code.. but just writting algorithm..
    mov ax, 0 //initial fibonacci number 0
    mov bx, 1 //next 1
    loop :
    mov cx, 0 //initialise cx with 0
    add cx, bx
    add cx, ax //final sum is in cx = ax + bx
    print cx
    mov bx, ax //put ax's value in bx
    mov ax, cx //put cx's value in ax
    jmp loop //now again add ax and bx in cx and print it

    add terminating condition in the loop


Sign In or Register to comment.