Arithmetic/Integer: Difference between revisions

m
no edit summary
m (changed 0 to zero.)
mNo edit summary
Line 3,345:
 
Note: spaces inside the ''$((...))'' are optional and not required; the ''$((...))'' can be inside or outside the double quotes, but the `...` expressions from the previous example can also be inside or outside the double quotes.
 
=={{header|Ursa}}==
<lang ursa>#
# integer arithmetic
#
 
decl int x y
out "number 1: " console
set x (in int console)
out "number 2: " console
set y (in int console)
 
out "\nsum:\t" (int (+ x y)) endl console
out "diff:\t" (int (- x y)) endl console
out "prod:\t" (int (* x y)) endl console
# quotient doesn't round at all, but the int function rounds up
out "quot:\t" (int (/ x y)) endl console
# mod takes the sign of x
out "mod:\t" (int (mod x y)) endl console</lang>
 
Sample session:
<pre>number 1: 15
number 2: 7
 
sum: 22
diff: 8
prod: 105
quot: 2
mod: 1</pre>
 
=={{header|VBA}}==
Anonymous user