RosettaCodeData/Task/Arithmetic-Integer/Jsish/arithmetic-integer.jsish

34 lines
904 B
Plaintext

"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!=
*/