~cpp
#include<stdio.h>
int cnt = 0;
void movehanoi(char a, char b, char c, int n);
void movehanoi(char from, char temp, char to, int n)
{
if(n==1){
++cnt;
printf("%5d:말뚝 %c 말뚝 %c 로 반 %d 동 \n", cnt, from, to, 1);
}
else{
movehanoi(from, to, temp, n-1);
++cnt;
printf("%5d:말뚝 %c 말뚝 %c 로 반 %d 동 \n", cnt, from, to, n);
movehanoi(temp, from, to, n-1);
}
}
//
int main(void)
{
int n;
printf("노 기려는 반 는?>");
scanf("%d", &n);
movehanoi('A', 'B', 'C', n);
return 0;
}
//료










