c# - 2-Dimensional Array Reduction -
I have a 2-dimensional array where I need to convert the first diagonal number to zero for example, Need to change:
[1 2 3] [5 9 5] [3 2 1] It means, diagonal 1 9 1 now 0 0 :
[0 2 3] [5 0 5] [3 2]] How can I do it efficiently in C #?
All you are doing, when the points in the grid are set to zero, when x and Y are similar (1,1), (2,2), and so on;
int x = 4, y = 5; Int [,] array = new int [x, y]; // Let's start with some values (int i = 0; i & lt; x & i & lt; y; i ++) for this {array [i, i] = 0; }
Comments
Post a Comment