Arithmetic/Integer: Difference between revisions
Content added Content deleted
m (→{{header|Sidef}}: code simplification) |
(Added zkl) |
||
Line 2,910: | Line 2,910: | ||
write, "x % y =", x % y; // remainder; matches sign of first operand when operands' signs differ |
write, "x % y =", x % y; // remainder; matches sign of first operand when operands' signs differ |
||
write, "x ^ y =", x ^ y; // exponentiation</lang> |
write, "x ^ y =", x ^ y; // exponentiation</lang> |
||
=={{header|zkl}}== |
|||
<lang zkl>x,y:=ask("Two ints: ").split(" ").apply("toInt"); |
|||
println("x+y = ",x + y); |
|||
println("x-y = ",x - y); |
|||
println("x*y = ",x * y); |
|||
println("x/y = ",x / y); // rounds toward zero |
|||
println("x%y = ",x % y); // remainder; matches sign of first operand when operands' signs differ |
|||
println("x.divr(y) = ",x.divr(y)); // (x/y,remainder); sign as above</lang> |
|||
[[Category:Arithmetic]] |
[[Category:Arithmetic]] |