Towers of Hanoi: Difference between revisions

no edit summary
m (→‎{{header|REXX}}: added/changed whitespace and comments.)
No edit summary
Line 2,248:
 
%%EOF</lang>
 
=={{header|PowerShell}}==
 
{{works with|PowerShell|4.0}}
<lang PowerShell>
function hanoi($n, $a, $b, $c) {
if($n -eq 1) {
"$a -> $c"
} else{
hanoi ($n - 1) $a $c $b
hanoi 1 $a $b $c
hanoi ($n - 1) $b $a $c
}
}
hanoi 3 "A" "B" "C"
</lang>
<b>Output:</b>
<pre>
A -> C
A -> B
C -> B
A -> C
B -> A
B -> C
A -> C
</pre>
 
=={{header|Prolog}}==
678

edits