Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void FillMatrix1(int[,] matrix)
- {
- int size = matrix.GetLength(0) * matrix.GetLength(1);
- int row = 0;
- int col = 0;
- for (int i = 1; i <= size; i++)
- {
- matrix[row, col] = i;
- row++;
- if (row == matrix.GetLength(0))
- {
- row = 0;
- col++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment