Ethiopian multiplication: Difference between revisions

Content added Content deleted
(→‎{{header|Bash}}: added Bash solution)
m (→‎{{header|Bash}}: replaced mult and div with bitwise shifts so as to fit better with the spirit of the problem)
Line 259: Line 259:
<lang bash>halve() {
<lang bash>halve() {
local n=$1
local n=$1
echo -n $(( n / 2 ))
echo -n $(( n >> 1 ))
}
}


double() {
double() {
local n=$1
local n=$1
echo -n $(( n * 2 ))
echo -n $(( n << 1 ))
}
}