Answer to Question #284829 in Assembler for Ahmed Ali

Question #284829

1) Convert the following pseudo-code to assembly language:


a = 0 b=2

for (i=0, i<=9 , i+2)

{

a=a+b

cout<<"number="<<a<<endl;

a++

}


1
Expert's answer
2022-01-04T13:55:09-0500
;MS Visual Studio 2017
INCLUDE irvine32.inc
.data

.code
main PROC
    mov eax, 0      ; a = 0
    mov ebx, 2      ; b = 2
    mov ecx, 0        ; i = 0;

forI:
    add eax, ebx    ; a=a+b
    call writeDec
    call crlf        

    inc eax        ;a++
    add ecx,2    ; i+2
    cmp ecx, 9
    jle forI


    call crlf                    
    call crlf                
    call waitMsg    
    exit
main ENDP
END main

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS