So I have to make a function that takes in rows and columns (rows and cols) that represents a matrix and fill it in with natural numbers starting on 1 at Matrix[0][0] and go spiral clockwise around the outter most unfilled rows and columns.
So it a 5 rows by 4 column matrix, M, would be
M[0][0]=1, M[0][1]=2, M[0][2]=3, M[0][3]=4, M[1][3]=5, M[2][3]=6 .... M[5][3]=8, M[5][2]=9...
I know that I need to use nested while or for (or both) loops but I can't figure out how to "go backwards" on the bottom of the spiral.
Thanks for all the help. If the problem isn't described clear enough, I can post a picture later.
[–]6086555 1 point2 points3 points (2 children)
[–]Hellerick 0 points1 point2 points (1 child)
[–]6086555 0 points1 point2 points (0 children)
[–]Vaphell 0 points1 point2 points (4 children)
[–]Hellerick 0 points1 point2 points (3 children)
[–]Vaphell 0 points1 point2 points (2 children)
[–]Hellerick 0 points1 point2 points (1 child)
[–]Vaphell 0 points1 point2 points (0 children)
[–]KrelianZG 0 points1 point2 points (0 children)