Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _9.Rotate_a_Matrix
- {
- class Program
- {
- static void Main(string[] args)
- {
- int rows = int.Parse(Console.ReadLine());
- int cow = int.Parse(Console.ReadLine());
- string[,] matrix = new string[rows, cow];
- for (int i = 0; i < rows; i++)
- {
- string inputRow = Console.ReadLine(); // чете целия ред
- string[] inputCols = inputRow.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); // прави ми ги на масив, като премахва интервалите
- for (int k = 0; k < cow; k++)
- {
- matrix[i, k] = inputCols[k]; // присвоява k
- }
- Console.WriteLine();
- }
- for (int i = 0; i < cow; i++)
- {
- for (int k = 0; k < rows; k++)
- {
- Console.Write(matrix[rows - 1 - k, i] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement