Arithmetic/Integer: Difference between revisions
Content added Content deleted
m (→{{header|UNIX Shell}}: Turn on the color with 'lang bash', not 'lang sh'. A shell with version 5.2.14 must be pdksh.) |
(Add bc. Sort languages near bc.) |
||
Line 207: | Line 207: | ||
Remainder sign matches: first operand |
Remainder sign matches: first operand |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Batch File}}== |
=={{header|Batch File}}== |
||
Line 228: | Line 220: | ||
@set /A C=%D% |
@set /A C=%D% |
||
@echo %D% = %C%</lang> |
@echo %D% = %C%</lang> |
||
=={{header|bc}}== |
|||
<lang bc>define f(a, b) { |
|||
"add: "; a + b |
|||
"sub: "; a - b |
|||
"mul: "; a * b |
|||
"div: "; a / b /* truncates toward zero */ |
|||
"mod: "; a % b /* same sign as first operand */ |
|||
"pow: "; a ^ b |
|||
}</lang> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Brat}}== |
=={{header|Brat}}== |