Arithmetic/Integer: Difference between revisions

Second implementation, python inspired
(VBScript entry)
(Second implementation, python inspired)
Line 1,138:
wscript.echo "a mod b=", a mod b
wscript.echo "a ^ b=", a ^ b
</lang>
 
=====Another Implementation=====
Gives the same output for the same input. Inspired by Python version.
<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 )
 
dim op
for each op in split("+ - * / \ mod ^", " ")
wscript.echo "a",op,"b=",eval( "a " & op & " b")
next
</lang>
 
Anonymous user