First of all... sorry but one note aside:
That your company rules don't allow to show code... it is perfectly understable and I find it very good that you follow the rules.
But...
You are asking for help, repeating 3 times the same sentence doesn't clarify anything.
If you don't want to show the code of the company, then don't do it, but at least you still can use pseudo-code to explain the steps you are doing and where are you getting problems
Learn how to use the debugger. This is something you should be able to solve on your own actually pretty quick
Please don't take it personally, it is not an attack against you, just a philosophical question: Are you sure you are prepared to do this job?
And I am not speaking about the technical content, everyone is a newbie at the beggining. I am thinking on other habilities... i.e. curiosity, tenacity, logical thinking and others related.
I would recommend you to try it first on your own and learn from your mistakes, this is the best school you can get. Don't give up easily and come here to ask. Of course it is confortable and you will probably always find someone that answers you. The most important point is... you won't learn so much and you will miss a very big reward for your soul, that is the satisfaction of being able to solve things on your own.
----------------------
Now to the technical side. I am not going to give you a ready solution, and probably there are better ways to solve this, but... it is still a way that you can infere / guess just taking paper and pencil and doing 2 or 3 examples to search for a pattern:
Assuming a Matrix A(MxN) no matter M and N values
1) Think on going through your matrix as squares / rectangles, each of them is one full iteration. You will need so many iterations as the ((smallest index / 2) + (smalles index % 2))
i.e.
A(2x6) = 2/2 + 2%2 = 1 rectangle or iteration
A(6x3) = 3/2 + 3%2 = 2 rectangles or iterations
A(7x7) = 7/2 + 7%2 = 4 rectangles or iterations
2) How do you do each square?
Line 1: From A(1+squareNr, 1+squareNr) to A(1+squareNr, N-squareNr)
Line 2: From A(1+squareNr, N-squareNr) to A(M-squareNr, N-squareNr)
Line 3: From A(M-squareNr, N-squareNr) to A(M-squareNr, 1+squareNr)
Line 4: From A(M-squareNr, 1+squareNr) to A(1+(squareNr+1), 1+squareNr)
3) You end when you reach the last element = M*N
A(2x6) = 12
A(6x3) = 18
A(7x7) = 49
4) Now you only have to figure out how to use the loops and the conditions to manage this. Point 2) is considering 0-based iterations, adapt it if you prefer start counting in 1
edits to correct spelling and make sentence more coherent
Updated 23-Sep-16 4:16am
v4
This smells of homework, so no code!
It's not difficult, it's just cumbersome.
Declare eight variables: X, Y, dX, dY, minX, maxX, minY, maxY.
Set them to 0, 0, 1, 0, 0, width, 0, height respectively.
Now set up a loop to look at each cell: width * height.
Inside the loop, print the X,Y cell.
Now add dX to X and dY to Y.
Check X:
If it's equal to maxX then reduce it by one, increment y by one, increment minX, and set dX to 0, dY to 1.
If it's equal to minX then increment it by one, reduce y by one, decrement maxY, and set dX to 0, dY to -1.
Check Y:
If it's equal to maxY then reduce it by one, decrement x by one, decrement maxX, and set dX to -1, dY to 0.
If it's equal to minY then increment it by one, increment x by one, increment minX, and set dX to 1, dY to 0.
That should do it.
Updated 23-Sep-16 5:48am
v2