Arithmetic/Integer: Difference between revisions

Content added Content deleted
(Add Avail entry)
(→‎{{header|Wren}}: Added notes, prompts, exponentiation, sample output and syntax highlighting.)
Line 4,821: Line 4,821:


=={{header|Wren}}==
=={{header|Wren}}==
In Wren the quotient operator '/' does not round but, when the ''floor'' method is applied to the result, it rounds to the lower integer.
<lang wren>

import "io" for Stdin
The sign of the remainder operator '%' matches the sign of the first operand.
<lang ecmascript>import "io" for Stdin, Stdout
System.write("first number: ")
Stdout.flush()
var a = Num.fromString(Stdin.readLine())
var a = Num.fromString(Stdin.readLine())
System.write("second number: ")
Stdout.flush()
var b = Num.fromString(Stdin.readLine())
var b = Num.fromString(Stdin.readLine())
System.print("sum: %(a + b)")
System.print("sum: %(a + b)")
Line 4,830: Line 4,836:
System.print("integer quotient: %((a / b).floor)")
System.print("integer quotient: %((a / b).floor)")
System.print("remainder: %(a % b)")
System.print("remainder: %(a % b)")
System.print("exponentiation: %(a.pow(b))")</lang>
</lang>

{{out}}
Sample input/output:
<pre>
first number: 4
second number: 3
sum: 7
difference: 1
product: 12
integer quotient: 1
remainder: 1
exponentiation: 64
</pre>


=={{header|x86 Assembly}}==
=={{header|x86 Assembly}}==