Towers of Hanoi is a puzzle where we have three towers with n disks and what we need to do is move the entire stack of discs from one tower to the other,taking into consideration the following rules:
- We can move only one disk at a time.
- We can move only the topmost disc from each tower.
- We cannot place a bigger disc on top of a smaller disc.
We need to give the number of discs as an input
The output will give the status of each towers.
enter the number of discs
5
Tower 1-> 1 2 3 4 5
Tower 2->
Tower 3->
The status of towers after calling the function-
Tower 1->
Tower 2->
Tower 3-> 1 2 3 4 5