#include
using namespace std;
void hanoi(int n, char src,char dest, char help){
if(n==0){
return;
}
hanoi(n-1,src,help,dest);
cout<<"Moving disc “<<n<<” from “<<src<<” to "<<dest<<endl;
hanoi(n-1,help,dest,src);
}
int main(){
int n;
cin>>n;
hanoi(n,‘A’,‘B’,‘C’);
return 0;
}
Hanoi-answer wrong
hey @jhanvimalik, logic is correct, check the statement you need to print wrong statement
you should print according to this format
Move 1th disc from T1 to T3
Move 2th disc from T1 to T2
Move 1th disc from T3 to T2
3