Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Random random = new Random();
- int maximumArrayLehgth = 10;
- int minimumArrayLength = 2;
- int maximumNumber = 9;
- int numberOfOperatedColumn = 1;
- int numberOfOperatedRow = 2;
- int indexOfOperatedColumn = numberOfOperatedColumn - 1;
- int indexOfOperatedRow = numberOfOperatedRow - 1;
- int countColumns = random.Next(minimumArrayLength, maximumArrayLehgth + 1);
- int countRows = random.Next(minimumArrayLength, maximumArrayLehgth + 1);
- int sumOfOperatedRow = 0;
- int powOfOperatedColumn = 1;
- int[,] array = new int[countColumns, countRows];
- Console.WriteLine($"Двумерный массив:");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = random.Next(1, maximumNumber);
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < array.GetLength(0); i++)
- {
- powOfOperatedColumn *= array[i, indexOfOperatedColumn];
- }
- for (int i = 0; i < array.GetLength(1); i++)
- {
- sumOfOperatedRow += array[indexOfOperatedRow, i];
- }
- Console.WriteLine($"Сумма строки номер {numberOfOperatedRow}: {sumOfOperatedRow}");
- Console.WriteLine($"Произведение столбца номер {numberOfOperatedColumn}: {powOfOperatedColumn}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement