write a c program to solve the Hanoi tower problem using problem decomposition *
ID: 3801317 • Letter: W
Question
write a c program to solve the Hanoi tower problem using problem decomposition
****no loops , no cin, include <stdio.h>******
An example of using the function: to print the sequence of moves to move 3 discs on pole 2 to pole 1 using pole 3 as a temporal pole can be done by moveDiscs(3, 2, 3, 1).
Steps to use
1.move the top n-1discs from pole a to pole b;
2.print: Move disc n from pole a to pole c;
3.move the n-1 discs from pole b to pole c.
Output
Input the number discs on pole a: 2
Move disc 1 from pole 1 to pole 2.
Move disc 2 from pole 1 to pole 3.
Move disc 1 from pole 2 to pole 3.
Explanation / Answer
Here is the code for above scenario:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.