Quote:
I have tired but not getting the logic. Please help me.
First help yourself with method.
You have noted that
You don't understand the logic:
- try to draw by hand the result wanted for each iteration in order.
- try to analyze the differences between each iteration an note what t(he changes are.
By this point, you should have got the logic, otherwise, talk to your teacher.
are you sure about the 9 in first iteration ?