18 lines
433 B
Plaintext
18 lines
433 B
Plaintext
#
|
|
# 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
|