Sha256: 4001ad34d11eb01119957a203e79cfa928af685c2aa8e14a45d29007b26cc71a

Contents?: true

Size: 742 Bytes

Versions: 10

Compression:

Stored size: 742 Bytes

Contents


(define a 8)
(define b 12)

(print "(+ " a " " b ") => "    (+ a b))
(print "(- " a " " b ") => "    (- a b))
(print "(* " a " " b ") => "    (* a b))
(print "(/ " a " " b ") => "    (/ a b))

(print "(quotient " a " " b ") => "  (quot a b)) ; same as (quotient a b)
(print "(remainder " a " " b ") => " (rem  a b)) ; same as (remainder a b)
(print "(modulo " a " " b ") => "    (mod  a b)) ; same as (modulo a b)

(print "(expt " a " " b ") => " (expt a b))
(print "(gcd " a " " b ") => " (gcd a b))
(print "(lcm " a " " b ") => " (lcm a b))

; you can use more than two arguments for +,-,*,/ functions
(print (+ 1 3 5 7 9))
(print (- 1 3 5 7 9))
(print (* 1 3 5 7 9)) ; same as (1*3*5*7*9)
(print (/ 1 3 5 7 9)) ; same as (((1/3)/5)/7)/9

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/ol.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/ol.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/ol.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/ol.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/ol.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/ol.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/ol.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/ol.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/ol.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/ol.txt