Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StartCode]
- using System;
- namespace ConsoleApp13
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int[,] array = new int[5, 5];
- int lineSum = 0;
- int line = 2;
- int columnMultiplying = 1;
- int column = 1;
- int indent = 1;
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = random.Next(10);
- }
- }
- Console.WriteLine("Дан массив : ");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- for (int i = 0; i < array.GetLength(1); i++)
- {
- lineSum += array[line - indent, i];
- }
- Console.WriteLine($"Сумма {line} строки данного массива : {lineSum}");
- Console.WriteLine();
- for (int i = 0; i < array.GetLength(0); i++)
- {
- columnMultiplying *= array[i, column - indent];
- }
- Console.WriteLine($"Произведение {column} столбца : {columnMultiplying}");
- }
- }
- }
- [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment