kwest87

Untitled

Dec 12th, 2023
629
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. [StartCode]
  2. using System;
  3.  
  4. namespace ConsoleApp13
  5. {
  6.     internal class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Random random = new Random();
  11.             int[,] array = new int[5, 5];
  12.             int lineSum = 0;
  13.             int line = 2;
  14.             int columnMultiplying = 1;
  15.             int column = 1;
  16.             int indent = 1;
  17.  
  18.             for (int i = 0; i < array.GetLength(0); i++)
  19.             {
  20.                 for (int j = 0; j < array.GetLength(1); j++)
  21.                 {
  22.                     array[i, j] = random.Next(10);
  23.                 }
  24.             }
  25.  
  26.             Console.WriteLine("Дан массив : ");
  27.  
  28.             for (int i = 0; i < array.GetLength(0); i++)
  29.             {
  30.                 for (int j = 0; j < array.GetLength(1); j++)
  31.                 {
  32.                     Console.Write(array[i, j] + " ");
  33.                 }
  34.  
  35.                 Console.WriteLine();
  36.             }
  37.  
  38.             Console.WriteLine();
  39.  
  40.             for (int i = 0; i < array.GetLength(1); i++)
  41.             {
  42.                 lineSum += array[line - indent, i];
  43.             }
  44.  
  45.             Console.WriteLine($"Сумма {line} строки данного массива : {lineSum}");
  46.             Console.WriteLine();
  47.  
  48.             for (int i = 0; i < array.GetLength(0); i++)
  49.             {
  50.                 columnMultiplying *= array[i, column - indent];
  51.             }
  52.  
  53.             Console.WriteLine($"Произведение {column} столбца : {columnMultiplying}");
  54.         }
  55.     }
  56. }
  57. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment