include irvine32.inc
.386
.stack 4096
Exitprocess proto,dwExitcode:dword
.data
str1 byte "enter first number:",0
str2 byte "enter second number:",0
num1 dword ?
num2 dword ?
sum dword ?
subt dword ?
mult dword ?
.code
main proc
call sumof
invoke Exitprocess,0
main endp
;this is the sumof function
sumof proc
call getnum
mov eax,num1
mov ebx,num2
add eax,ebx
mov sum,eax
call WriteInt
call crlf
call subof
ret
sumof endp
;this is the sumof function
subof proc
mov eax,0
mov ebx,0
call getnum
mov eax,num1
mov ebx,num2
sub eax,ebx
mov subt,eax
call WriteInt
call crlf
call mulof
ret
subof endp
;this is the sumof function
mulof proc
mov eax,0
mov ebx,0
call getnum
mov eax,num1
mov ebx,num2
mul ebx
mov mult,eax
call WriteInt
call crlf
ret
mulof endp
;this is the getnum function
getnum proc
mov edx,offset str1
call WriteString
call ReadInt
mov num1,eax
mov edx,offset str2
call WriteString
call ReadInt
mov num2,eax
call crlf
ret
getnum endp
end main
No comments:
Post a Comment