procedure hanoi (n : integer; source,destination,help : char); begin if n=1 then writeln('Move a disk from ',source, ' to ',destination) else begin hanoi(n-1,source,help,destination); hanoi(1,source,destination,help); hanoi(n-1,help,destination,source); end; end; |