Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 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 ConsoleApp10
  8. {
  9.     class Program
  10.     {
  11.         const int len = 4;
  12.         const int len2 = 2;
  13.         static int[,] Input()
  14.         {
  15.            
  16.             int[,] massive = new int[len, len2];
  17.             for (int i = 0; i < len; i++)
  18.             {
  19.                 for (int j = 0; j < len2; j++)
  20.                 {
  21.                     Console.WriteLine("Введите " + j + " элемент");
  22.                     massive[i, j] = int.Parse(Console.ReadLine());
  23.  
  24.                 }
  25.  
  26.             }
  27.  
  28.             return massive;
  29.         }
  30.         static void Change(int[,] massive)
  31.         {
  32.             for(int i=0;i<len2;i++)
  33.             {
  34.                 int t = massive[1, i];
  35.                 massive[1, i] = massive[len - 2, i];
  36.                  massive[len - 2, i]=t;
  37.             }
  38.             for (int i = 0; i < len; i++)
  39.             {
  40.                 for (int j = 0; j < len2; j++)
  41.                 {
  42.                     Console.Write(massive[i, j] + " ");
  43.                 }
  44.             }
  45.         }
  46.         static void Main(string[] args)
  47.         {
  48.             int[,] massive = Input();
  49.             Change(massive);
  50.  
  51.  
  52.         }
  53.  
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement