Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Towers of Hanoi

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:

  1. We can move only one disk at a time.
  2. We can move only the topmost disc from each tower.
  3. We cannot place a bigger disc on top of a smaller disc.

Input Format

We need to give the number of discs as an input

Output Format

The output will give the status of each towers.

Sample Input

enter the number of discs
5

Sample Output

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

Implemented in: