Anonymous user
Arithmetic/Integer: Difference between revisions
→{{header|UNIX Shell}}: SUSv3 says that $(($x)) and $((x)) are alike, so remove the extra dollar signs.
(→{{header|Ruby}}: Also do exponentiation.) |
(→{{header|UNIX Shell}}: SUSv3 says that $(($x)) and $((x)) are alike, so remove the extra dollar signs.) |
||
Line 1,627:
=={{header|UNIX Shell}}==
The Unix shell does not directly support arithmetic operations
{{works with|Bourne
{{works with|Almquist SHell}}
<lang sh>#!/bin/sh
Line 1,639:
echo "a mod b = " `expr $a % $b` # same sign as first operand</lang>
With SUSv3 parameter expansions:
Line 1,648:
<lang bash>#!/bin/sh
read a; read b;
echo "a+b = $((
echo "a-b = $((
echo "a*b = $((
echo "a/b = $((
echo "a mod b = $((
=={{header|Vedit macro language}}==
|