Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp3
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int matrixRow = 3;
- int matrixColumn = 3;
- int[,] matrix = new int[matrixRow, matrixColumn];
- Random random = new Random();
- int randomMaxRange = 100;
- int randomMinRange = 11;
- int rowIndex;
- int columnIndex;
- int summRowIndex = 1;
- int multColumnIdex = 0;
- int summResult = 0;
- int multResult = 1;
- for (rowIndex = 0; rowIndex < matrix.GetLength(0); rowIndex++)
- {
- for (columnIndex = 0; columnIndex < matrix.GetLength(1); columnIndex++)
- {
- matrix[rowIndex, columnIndex] = random.Next(randomMinRange, randomMaxRange);
- Console.Write(matrix[rowIndex, columnIndex] + " ");
- if (rowIndex == summRowIndex)
- {
- summResult += matrix[rowIndex, columnIndex];
- }
- if (columnIndex == multColumnIdex)
- {
- multResult *= matrix[rowIndex, columnIndex];
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine($"\nСумма второй строки равна = {summResult}.\n" +
- $"Произведение первого столбца = {multResult}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement