AlexRaynor

3.3 Matrix

Sep 5th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApplication2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int[,] matrix = {
  10.                 { 0, 1, 2 },
  11.                 { 3, 4, 5 },
  12.                 { 6, 7, 8 }
  13.             };
  14.  
  15.             int sum = 0, prod = 1;
  16.             for (int j = 0; j < 3; j++)
  17.                 sum += matrix[1, j];
  18.             for (int i = 0; i < 3; i++)
  19.                 prod *= matrix[i, 0];
  20.             Console.WriteLine("Сумма элементов второй строки равна " + sum + ", Произведение элементов первого столбца равно " + prod);
  21.  
  22.  
  23. }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment