Third Q :
create two Stack objects, insert given elements in the question.
then do a while loop with base condition (! obj1.isEmpty && ! obj2.isEmpty)
then assign the top of each stack by using (obj.pop() for both objects) to a variables. And assign these variables to anew “ sum” variables.
After that do the print statement to printout as given sample output .
Then you may do “if statement” to check whether the stack isEmpty or not
In same time to print the other stack remaining elements in case there is so.