Advertisement
Vadim_Rogulev

Untitled

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