Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = new int[5, 5];
- Random rand = new Random();
- int sumSecondString = 0;
- int multFirstColumn = 1;
- int multFirstColumn2 = 1;
- Console.WriteLine("Матрица данного двумероного массива: \n");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int y = 0; y < array.GetLength(1); y++)
- {
- int randomNumber = rand.Next(1, 20);
- array[i, y] = randomNumber;
- Console.Write($"{array[i, y]} |");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- for(int i = 0; i < array.GetLength(1); i++)
- {
- sumSecondString += array[1,i];
- }
- for (int i = 0; i < array.GetLength(1); i++)
- {
- multFirstColumn *= array[i, 0];
- }
- for (int i = 0; i < array.GetLength(0); i++)
- {
- multFirstColumn2 *= array[i, 0];
- }
- Console.WriteLine($"Сумма 2й строки массива {sumSecondString}");
- Console.WriteLine($"Произведения в1 первых столбцов массива {multFirstColumn}");
- Console.WriteLine($"Произведения в1 первых столбцов массива {multFirstColumn2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment