No older revisions available
No older revisions available
~cpp #include <stdio.h> int hanoi(int, int, int, int); void move(int, int); int main() { hanoi(2,1,3,2); } int hanoi(int n, int a, int b, int c) { if(n>0) { hanoi(n-1,a,c,b); move(a,b); hanoi(n-1,c,b,a); } } void move(int from, int to) { printf("%d->%d ",from,to); }