the program can still work without count
Why we are using count
see we need to have a check on the total number of elements that we have printed so far…moreover when the matrix is diagonal it prevents us from getting array index out of bound(by not running the for loop)
please share your code here…also first try to run it for rectangular matrix
unable to understand what you are saying
in the for loop if i impose a condition that my count<total elements then i can prevent from getting array index out of bound as we will not be running that for loop…
moreover as you mentioned that the problem can work without count so i asked you to share that code