Arithmetic/Integer: Difference between revisions

Content added Content deleted
(don't use EVAL)
(→‎{{header|J}}: Add exponentiation and example output, fix remainder, fix tacit definition order)
Line 409: Line 409:


=={{header|J}}==
=={{header|J}}==
calc =: + , - , * , <.@% , |~ , ^
bia =: title"_ combine calc
labels =: >;.2 'Sum: Difference: Product: Quotient: Remainder: Exponentiation: '
calc =: + , - , * , <.@% , |
combine =: [ ,. ":@|:@,:@]
combine =: [ ,. ":@|:@,:@]
bia =: labels combine calc
title =: >;.2 'Sum: Difference: Product: Quotient: Remainder: '

Note that the verb <tt>calc</tt> produces all the processing specified for this problem, and that its output is of numeric type. Since other examples here provide textual output, <tt>bia</tt> produces like results.
Note that the verb <tt>calc</tt> produces all the processing specified for this problem, and that its output is of numeric type.
17 calc 3
20 14 51 5 2 4913

Since other examples here provide textual output, <tt>bia</tt> produces like results.

17 bia 3
Sum: 20
Difference: 14
Product: 51
Quotient: 5
Remainder: 2
Exponentiation: 4913


=={{header|Java}}==
=={{header|Java}}==