This problem can be easily solved using a stack. My explanation of Tracing recursive methods explains the technique.
Also see my complete 2009 AP CS A Multiple Choice solutions.
Stack based trace of 2009 AP CS A Multiple Choice #39
2009 AP CS A Multiple Choice #39 (as PDF)
what i can write a program in c or c++ languages that facilitates the trace of recursive program?
You don’t need to write a program to trace a recursive method. The debugger in any IDE will show you the method calls in a stack.