Sha256: 1c1b00bd2b60dfeb18a90302ef2e60a2ee47c30839116cac1a403e180c764f1b

Contents?: true

Size: 904 Bytes

Versions: 10

Compression:

Stored size: 904 Bytes

Contents

"use strict";
/* Arthimetic/Integer, in Jsish */
var line = console.input();
var nums = line.match(/^\s*([+-]?[0-9]+)\s+([+-]?[0-9]+)\s*/);
var a = Number(nums[1]);
var b = Number(nums[2]);

puts("A is ", a, ", B is ", b);
puts("Sum               A + B is ", a + b);
puts("Difference        A - B is ", a - b);
puts("Product           A * B is ", a * b);
puts("Integer quotient  A / B is ", a / b | 0, " truncates toward 0");
puts("Remainder         A % B is ", a % b, " sign follows first operand");
puts("Exponentiation    A to the power B is ", Math.pow(a, b));

/*
=!INPUTSTART!=
7 4
=!INPUTEND!=
*/


/*
=!EXPECTSTART!=
A is  7 , B is  4
Sum               A + B is  11
Difference        A - B is  3
Product           A * B is  28
Integer quotient  A / B is  1  truncates toward 0
Remainder         A % B is  3  sign follows first operand
Exponentiation    A to the power B is  2401
=!EXPECTEND!=
*/

Version data entries

10 entries across 7 versions & 1 rubygems

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