alexmitev

Untitled

Nov 24th, 2015
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1.  static void FillMatrix1(int[,] matrix)
  2.     {
  3.         int size = matrix.GetLength(0) * matrix.GetLength(1);
  4.         int row = 0;
  5.         int col = 0;
  6.         for (int i = 1; i <= size; i++)
  7.         {
  8.             matrix[row, col] = i;
  9.             row++;
  10.             if (row == matrix.GetLength(0))
  11.             {
  12.                 row = 0;
  13.                 col++;
  14.             }
  15.         }
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment