In Tower of Hanoi we have to move all the disc from (assumes you have 3 tower namely A, B, C) tower A to tower C, in the same order as the disc are on tower A, with the help of tower B.
void swap_towers(int, char, char, char); //prototype for my recursive function.
printf("Enter the number of disks : ");
printf("Movement of disks (i.e form Tower A to Tower B) involved in the Tower of Hanoi are :\n");
swap_towers(num_disk, 'A', 'C', 'B');
void swap_towers(int num, char from_tower, char to_tower, char ex_tower)
if (num == 1) // Condition to stop the recursion.
printf("\nMove disk 1 from Tower %c to Tower %c", from_tower, to_tower);
swap_towers(num - 1, from_tower, ex_tower, to_tower);
printf("\nMove disk %d from Tower %c to Tower %c", num, from_tower, to_tower);
swap_towers(num - 1, ex_tower, to_tower, from_tower);