hanoi(n,x,y,z) { hanoi(n-1,x,z,y);//n-1 from x to y move(x,z);//x->z hanoi(n-1,y,x,z);//n-1 from y to z } hanoi(n-1,x,z,y) { hanoi(n-2,x,y,z);//n-2 from x to z move(x,y);//n-1 from x to y hanoi(n-2,z,x,y);//n-2 from z to y } the step move(x,y) is wh…