Arithmetic/Integer: Difference between revisions

Content added Content deleted
No edit summary
(VBScript entry)
Line 1,115: Line 1,115:
Message("a / b = ") Num_Type(#1 / #2)
Message("a / b = ") Num_Type(#1 / #2)
Message("a % b = ") Num_Type(#1 % #2)</lang>
Message("a % b = ") Num_Type(#1 % #2)</lang>

=={{header|VBScript}}==
VBScript's variables are all Variants. What starts out as an integer may be converted to something else if the need arises.

=====Implementation=====
<lang vb>
option explicit
dim a, b
wscript.stdout.write "A? "
a = wscript.stdin.readline
wscript.stdout.write "B? "
b = wscript.stdin.readline

a = int( a )
b = int( b )

wscript.echo "a + b=", a + b
wscript.echo "a - b=", a - b
wscript.echo "a * b=", a * b
wscript.echo "a / b=", a / b
wscript.echo "a \ b=", a \ b
wscript.echo "a mod b=", a mod b
wscript.echo "a ^ b=", a ^ b
</lang>

=====Invocation=====
<pre>
C:\foo>arithmetic.vbs
A? 45
B? 11
a + b= 4511
a - b= 34
a * b= 495
a / b= 4.09090909090909
a \ b= 4
a mod b= 1
a ^ b= 1.5322783012207E+18
</pre>


=={{header|Visual Basic .NET}}==
=={{header|Visual Basic .NET}}==