alexey3017

Untitled

Mar 22nd, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 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. namespace Learn1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int[,] array = { {1,2,3,4,5}, {4,5,6,7,8}, {2,1,3,5,6}};
  13.             int summ = 0;
  14.             int composition = 1;
  15.  
  16.             Console.WriteLine("Исходная матрица:");
  17.             for (int i = 0; i < array.GetLength(0); i++)
  18.             {
  19.                 for (int j = 0; j < array.GetLength(1); j++)
  20.                 {
  21.                     Console.Write(array[i,j] + " ");
  22.                 }
  23.                 Console.WriteLine();
  24.             }
  25.    
  26.             for (int i = 0; i < array.GetLength(0); i++)
  27.             {
  28.                 for (int j = 0; j < array.GetLength(1); j++)
  29.                 {
  30.                     if (i == 1)
  31.                     {
  32.                         summ += array[i, j];
  33.                     }
  34.                     if (j == 0)
  35.                     {
  36.                         composition *= array[i, j];
  37.                     }
  38.                 }
  39.             }
  40.             Console.WriteLine("Произвеление первого столбца: " + composition);
  41.             Console.WriteLine("Сумма второй строки:" + summ);
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment