~cpp
#include <iostream>
using namespace std;
void hanoi(int n, int from, int by, int to);
int main()
{
int n;
int from, by, to;
cout << "= =\n";
cout << " 개 : ";
cin >> n;
hanoi(n, 1, 2, 3);
return 0;
}
void hanoi(int n, int from, int by, int to)
{
if(n==1)
cout << from << "->" << to <<"\n";
else
{
hanoi(n-1, from, to, by);
hanoi(1, from, by, to);
hanoi(n-1, by, from, to);
}
}










