Professional Documents
Culture Documents
Code:: DB DB DB DB DB
Code:: DB DB DB DB DB
Code:: DB DB DB DB DB
global _main
extern _printf ; import external functionality
extern _scanf ; import external functionality
section .data
message1 db "Enter first number: ", 0 ; Initialize variable for prompt
message
message2 db "Enter second number: ", 0
formatIn db '%d', 0 ; Initialize variable for user input format
formatOut db '%d', 10, 0 ; Initialize variable for output format
show db "Sum: ", 0 ; Initialize variable for the output message
section .bss
firstInt resb 4 ; declare 4 bytes sized variable
secondInt resb 4 ; declare 4 bytes sized variable
section .text
_main:
; display the first prompt message
push message1
call _printf
pop eax
; Wait for the user input and store it
; in the variable firstInt with an integer format
push firstInt
push formatIn
call _scanf
pop eax
pop eax
; display the second prompt message
push message2
call _printf
pop eax
; Wait for the user input and store it
; in the variable secondInt with an integer format
push secondInt
push formatIn
call _scanf
pop eax
pop eax
OUTPUT: