Ethiopian multiplication: Difference between revisions

Undo revision 94268 by 161.49.249.254 (talk) Doesn't use the three named functions as required in the task description
(Undo revision 94268 by 161.49.249.254 (talk) Doesn't use the three named functions as required in the task description)
Line 1,733:
 
=={{header|PowerShell}}==
===Traditional===
<lang PowerShell>function isEven {
param ([int]$value)
Line 1,769 ⟶ 1,768:
 
multiplyValues 17 34</lang>
===With Pipes===
<lang PowerShell>function ethiopian( [int] $lhs , [int] $rhs )
{
$scratch = @{}
while( $lhs -ge 1 )
{
$scratch[$lhs] = $rhs
$lhs = [math]::floor( $lhs / 2 )
$rhs *= 2
}
$scratch.keys | Where-Object { $_ % 2 } | ForEach-Object { $sum = 0 } { $sum += $scratch[$_] } { $sum }
}</lang>
 
=={{header|Powerbuilder}}==
<lang powerbuilder>public function boolean wf_iseven (long al_arg);return mod(al_arg, 2 ) = 0
Anonymous user