Advertisement
pol9na

Untitled

Mar 12th, 2020
97
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 Study
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int[,] array = new int[3, 3];
  13.             int sumOfTheSecondLine = 0, productOfTheFirstColumn = 1;
  14.             Console.WriteLine("Исходная матрица");
  15.             Random rand = new Random();
  16.             for (int i = 0; i < 3; i++)
  17.             {
  18.                 for (int j = 0; j < 3; j++)
  19.                 {
  20.                     array[i, j] = rand.Next(0, 50);
  21.                     Console.Write(array[i, j] + " ");
  22.                 }
  23.                 Console.WriteLine();
  24.             }
  25.             for ( int i = 0; i < 3; i++)
  26.             {
  27.                 sumOfTheSecondLine += array[i, 1];
  28.             }
  29.             for (int j = 0; j < 3; j++)
  30.             {
  31.                 productOfTheFirstColumn *= array[j, 0];
  32.             }
  33.                     Console.WriteLine("Сумма второй строки");
  34.                     Console.Write(sumOfTheSecondLine);
  35.                     Console.WriteLine();
  36.                     Console.WriteLine("Произведение первого столбца");
  37.                      Console.Write(productOfTheFirstColumn);
  38.          }
  39.       }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement