You are on page 1of 1

#include<stdio.

h>

int TOH(int n,char source, char destination, char helper)


{
if(n==0)
{
return 0;
}
TOH(n-1,source,helper,destination);
printf("\n%d rings moved from %c to %c ",n,source, destination);
TOH(n-1,helper, destination,source);
}

int main()
{
TOH(3,'A','B','C');
return 0;
}

You might also like