#include <stdio.h> #include <stdlib.h> int count; void move(char a,char b); void hanoi(int n,char a,char b,char c); int main(int argc, char *argv[]) { int n; count=0; while(1){ scanf("%d",&n); hanoi(n,'a','b','c'); } system("PAUSE"); return 0; } void hanoi(int n,char a,char b,char c) { if(n==1) { move(a,c); }else { hanoi(n-1,a,c,b); move(a,c); hanoi(n-1,b,a,c); } } void move(char a,char b) { printf("%c-->%c\n",a,b); count++; }