Arithmetic/Integer: Difference between revisions

Add Nu
imported>J7M
(add example for SmallBASIC)
imported>Brie
(Add Nu)
Line 3,825:
Pop $0
FunctionEnd</syntaxhighlight>
 
=={{header|Nu}}==
Division rounds towards -infinity. Modulus will match the sign of the first number.
 
<syntaxhighlight lang="nu">
input | parse "{a} {b}" | first | values | into int | do {|a b|
{
Sum: ($a + $b)
Difference: ($a - $b)
Product: ($a * $b)
Quotient: ($a // $b)
Remainder: ($a mod $b)
Exponent: ($a ** $b)
}
} $in.0 $in.1
</syntaxhighlight>
{{out}}
<pre>
-1 2
╭────────────┬────╮
│ Sum │ 1 │
│ Difference │ -3 │
│ Product │ -2 │
│ Quotient │ -1 │
│ Remainder │ -1 │
│ Exponent │ 1 │
╰────────────┴────╯
</pre>
 
=={{header|Nutt}}==
Anonymous user