C语言怎么编写这个算法?

设a,b,c,d是4个塔座。开始时,在塔座a上有一叠共n个圆盘,这些圆盘自下而上,由大到小地叠在一起。各圆盘从小到大编号为1,2,3,。。。n,现要求将塔座a上的这一叠圆盘移到塔座b上,并仍然按同样顺序重叠。在移动圆盘时应该遵守以下移动规则。
规则1,每次只能移动1个圆盘;
规则2,任何时刻都不允许将较大的圆盘压在较小的圆盘之上;
规则3,在满足移动规则1和规则2的前提下,可将圆盘移至a,b,c,d任一塔座上。

汉诺塔算法

void move(char x,char y){
printf("%c-->%c\n",x,y);
}

void hanoi(int n,char one,char two,char three){
/*将n个盘从one座借助two座,移到three座*/
if(n==1) move(one,three);
else{
hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}
}

main(){
int n;
printf("input the number of diskes:");
scanf("%d",&n);
printf("The step to moving %3d diskes:\n",n);
hanoi(n,'A','B','C');
}