Sha256: 58fc6200ad0507e02a031128bf0ec6e63b3ee3bf14b0ff2674602f354856b23c

Contents?: true

Size: 675 Bytes

Versions: 10

Compression:

Stored size: 675 Bytes

Contents

ask "enter 2 numbers (comma separated)"
if it is not empty then
    put item 1 of it into n1
    put item 2 of it into n2
    put sum(n1,n2) into ai["sum"]
    put n1 * n2 into ai["product"]
    put n1 div n2 into ai["quotient"]  -- truncates
    put n1 mod n2 into ai["remainder"]
    put n1^n2 into ai["power"]
    combine ai using comma and colon
    put ai
end if
Examples-2,4  - power:16,product:-8,quotient:0,remainder:-2,sum:2
2,-4  - power:0.0625,product:-8,quotient:0,remainder:2,sum:-2
-2,-4 - power:0.0625,product:8,quotient:0,remainder:-2,sum:-6
2,4   - power:16,product:8,quotient:0,remainder:2,sum:6
11,4  - power:14641,product:44,quotient:2,remainder:3,sum:15

Version data entries

10 entries across 7 versions & 1 rubygems

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