#include /* * Move 'count' disks from pile 'from' to pile 'to'. * Pile 'spare' is available as a spare. */ void hanoi(int count, char from, char to, char spare) { if (count > 0) { hanoi(count-1, from, spare, to); printf("move disk %d from %c to %c\n", count, from, to); hanoi(count-1, spare, to, from); } } int main() { hanoi(5,'A','B','C'); return 0; }