Reputation: 1
Input are interger numbers and after calculation, i need the output is real number. How can I do it? Like when I enter 1,23,123 and the ouput of second calculation is -33 while the actual result is -33.3
include \masm32\include\masm32rt.inc
.code
start:
call main
exit
main proc
LOCAL var1:DWORD
LOCAL var2:DWORD
LOCAL var3:DWORD
LOCAL tong:DWORD
LOCAL result:DWORD
LOCAL remainder:DWORD
LOCAL a:DWORD
LOCAL b:DWORD
mov var1, sval(input("Enter number 1: "))
mov var2, sval(input("Enter number 2: "))
mov var3, sval(input("Enter number 3: "))
mov result, 0
print chr$("v1 + v2 + v3 = ")
mov eax, var1
add eax, var2
add eax, var3
mov tong, eax
print str$(tong)
print chr$(13,10)
print chr$("[(v1 * v2) - v3] / 3 = ")
mov eax, var1
cdq
Imul var2
cdq
mov a, eax
sub eax, var3
mov b, eax
mov edx, 0
mov eax, b
cdq
mov ecx,3
idiv ecx
mov result, eax
mov remainder, edx
print str$(result)
ret
main endp
end start
I need the output is real number.
Upvotes: 0
Views: 565