sir thanks for such a beautiful explanation.
My question is why do put the conditions (if(end_row>start_row)) and (if(end_col>start_col))
in the last two statements only???
I mean why do not you put the conditions in all 4 cases?
Spiral print of 2d array
hello @mzk1994
no in first 2 for loop we dont need any condition becuase we are updating variable after the loop.
in last two loop it is required becuase we are using updated values inside them. and it might happen that updated value is now wrong so to keep a check we r using if
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.