Advertisement
Danvil

Задание 1: Массивы

Jun 1st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 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 Задание_1_Массивы
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[,] array = {
  14.                 { 1,4,7},
  15.                 { 2,7,8},
  16.                 { 3,6,9}
  17.             };
  18.             for (int i = 0; i < 3; i++)
  19.             {
  20.                 for (int j = 0; j < 3; j++)
  21.                     Console.Write(String.Format(array[i, j] + " "));
  22.                 Console.WriteLine();
  23.             }
  24.  
  25.             for (int i = 0; i < 3; i++)
  26.                 for (int j = 0; j < 3 - 1; j++)
  27.                     for (int g = 0; g < 3; g++)
  28.                         if (array[j, g] < array[j + 1, g])
  29.                         {
  30.                             int temp = array[j, g];
  31.                             array[j, g] = array[j + 1, g];
  32.                             array[j + 1, g] = temp;
  33.                         }
  34.             for (int i = 0; i < 3; i++)
  35.             {
  36.                 for (int j = 0; j < 3; j++)
  37.                     Console.Write(String.Format(array[i, j] + " "));
  38.                 Console.WriteLine();
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement