~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);
}


Retrieved from http://wiki.zeropage.org/wiki.php/하노이탑/김태훈
last modified 2021-02-07 05:31:29