Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Random random = new Random();
- int minNumber = 2;
- int maxNumber = 10;
- int countColumns = random.Next(minNumber, maxNumber);
- int countLines = random.Next(minNumber, maxNumber);
- int[,] array = new int[countLines, countColumns];
- int columnNumber = 1;
- int lineNumber = 2;
- int summLine = 0;
- int productColumn = 1;
- Console.WriteLine($"Матрица [{countLines},{countColumns}]:\n");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = random.Next(minNumber, maxNumber);
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- if (i == (lineNumber - 1))
- {
- summLine += array[lineNumber - 1, j];
- }
- }
- }
- for (int i = 0; i < array.GetLength(0); i++)
- {
- productColumn *= array[i, columnNumber - 1];
- }
- Console.WriteLine($"\nСумма {lineNumber} строки = {summLine}\n" +
- $"Произведение {columnNumber} столбца = {productColumn}");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement