Advertisement
Guest User

Untitled

a guest
Dec 18th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int rows = int.Parse(Console.ReadLine());
  14.             int cols = int.Parse(Console.ReadLine());
  15.             int[,] matrix = new int[rows, cols];
  16.             for (int row = 0; row < matrix.GetLength(0); row++)
  17.             {
  18.                 for (int col = 0; col < matrix.GetLength(1); col++)
  19.                 {
  20.                     matrix[row, col] = int.Parse(Console.ReadLine());
  21.                 }
  22.             }
  23.             for (int row = 0; row < matrix.GetLength(0); row++)
  24.             {
  25.                 for (int col = 0; col < matrix.GetLength(1)/2; col++)
  26.                 {
  27.                     int counter = matrix[row, col];
  28.                     matrix[row, col] = matrix[row, matrix.GetLength(1) - col - 1];
  29.                     matrix[row, matrix.GetLength(1) - col - 1] = counter;
  30.                 }
  31.             }
  32.  
  33.             for (int row = 0; row < matrix.GetLength(0); row++)
  34.             {
  35.                 for (int col = 0; col < matrix.GetLength(1); col++)
  36.                 {
  37.                     Console.Write(matrix[row,col]);
  38.                 }
  39.                 Console.WriteLine();
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement