Syndicated Summary
Small PowerShell exercise taken from the Programming Praxis: Russian Peasant Multiplication contest of WTF (Worse than Failure) implementing the Russian Peasant Multiplication method (for more info see original contest post) function Invoke-RussianMultiply ([int]$a,[int]$b) { "$a x $b" $r = 0 while($a -ne 1){ $a = $a/2 $b = $b*2 "$a x $b" if ($a%2) {$r+=$b;"`t+$b"} } "result
Read More...
Read the complete post at http://thepowershellguy.com/blogs/posh/archive/2009/07/23/russian-peasant-multiplication.aspx
Posted
Jul 23 2009, 09:54 AM
by
The PowerShell Guy