Arithmetic/Integer: Difference between revisions
→{{header|Wren}}: Added notes, prompts, exponentiation, sample output and syntax highlighting.
(Add Avail entry) |
(→{{header|Wren}}: Added notes, prompts, exponentiation, sample output and syntax highlighting.) |
||
Line 4,821:
=={{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.
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())
System.write("second number: ")
Stdout.flush()
var b = Num.fromString(Stdin.readLine())
System.print("sum: %(a + b)")
Line 4,830 ⟶ 4,836:
System.print("integer quotient: %((a / b).floor)")
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
=={{header|x86 Assembly}}==
|