Ethiopian multiplication: Difference between revisions

Content added Content deleted
(Undo revision 65955. No better or worse than the references given. Certainly should not be put at the head of the task.)
(return is a keyword, not a function)
Line 184: Line 184:
<lang awk>function halve(x)
<lang awk>function halve(x)
{
{
return(int(x/2))
return int(x/2)
}
}


function double(x)
function double(x)
{
{
return(x*2)
return x*2
}
}


function iseven(x)
function iseven(x)
{
{
return((x%2) == 0)
return x%2 == 0
}
}


Line 207: Line 207:
plicand = double(plicand)
plicand = double(plicand)
}
}
return(r)
return r
}
}