Advertisement
pol9na

Untitled

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