need help) not necessarily code, enough clues, I will be grateful)

there is a matrix:

1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 

need to swap:

 4 3 2 1 1 2 3 4 4 3 2 1 1 2 3 4 

code:

 var array = new int[4, 4]; for (int i = 0; i < array.GetLength(0); i++) { for (int j = 0; j < array.GetLength(1); j++) { array[j, i] = i + 1; // array[j, i] = j+1; } } for (int i = 0; i < array.GetLength(0); i++) { for (int j = 0; j < array.GetLength(1); j++) { Console.Write(array[i, j].ToString(" #0")); } Console.WriteLine(); } 

Closed due to the fact that the essence of the question is incomprehensible by the participants Igor , aleksandr barakin , Enikeyschik , iluxa1810 , Herman Borisov January 18 at 9:19 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Maybe it is better to explain with Russian words what and where needs to be changed? At first glance it is necessary to reverse the even lines. This is true? - avp

1 answer 1

Pseudo-code:

  1. Go to the top-down matrix
  2. Check the line for parity using the % operator, which returns the remainder of the division.

If you are on an odd line, then sort from larger to smaller

If you are on an even, then from the smallest to the greatest.

Repeat until the end.

  • one
    Funny people))))) - nick_n_a