Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- namespace MultidimensionArrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- //int n = int.Parse(Console.ReadLine());
- int[,] matrix = new int[3, 3]
- {
- {1, 2, 3, },
- {4, 5, 6, },
- {7, 8, 9, },
- };
- //int[,] matrix = new int[n, n];
- //for (int i = 0; i < matrix.GetLength(0); i++)
- //{
- // for (int j = 0; j < matrix.GetLength(1); j++)
- // {
- // matrix[i, j] = int.Parse(Console.ReadLine());
- // }
- //}
- int rows = 0;
- int counter = 0;
- for (int row = matrix.GetLength(0) - 1; row >= 0; row--)
- {
- rows = row;
- for (int col = 0; col <= counter; col++)
- {
- Console.Write(matrix[rows, col] + " ");
- rows++;
- }
- Console.WriteLine();
- counter++;
- }
- int cols = 1;
- for (int i = matrix.GetLength(0) - 2; i >= 0; i--)
- {
- for (int row = 0; row <= i; row++)
- {
- Console.Write(matrix[row, cols] + " ");
- cols++;
- }
- Console.WriteLine();
- cols--;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment