Advertisement
denchik22

3.3

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