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 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] + " ");
- if(i == numberOfOperatedRow - 1)
- {
- sumOfOperatedRow += array[i, j];
- }
- if(j == numberOfOperatedColumn - 1)
- {
- powOfOperatedColumn *= array[i, j];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine($"Сумма строки номер {numberOfOperatedRow}: {sumOfOperatedRow}");
- Console.WriteLine($"Произведение строки номер {numberOfOperatedColumn}: {powOfOperatedColumn}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement