【文件属性】:
文件名称:汉诺塔c语言
文件大小:453B
文件格式:C
更新时间:2021-12-18 08:49:56
c+c+
#include
void move(int n,int a,int b,int c);
main()
{
int num;
printf("the number of plate is:");
scanf("%d",#);
move(num, 1, 2, 3);
return 0;
}
void move(int n, int from, int med, int to)
{
if (n==1)
printf("%dplate:%d-->%d \n",n,from, to);
else{
move(n-1, from, to, med);
printf("%dplate:%d-->%d \n", n,from, to);
move(n-1, med, from, to);
}
}