Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace HomeWork
- {
- internal class Program
- {
- public static void Main(string[] args)
- {
- int[,] matrix =
- {
- { 2, 3, 5 },
- { 4, 6, 8 },
- { 7, 1, 9 }
- };
- int sumSecondRow = 0;
- int productFirstColumn = 1;
- int columnIndex = 0;
- int rowIndex = 1;
- for (int j = 0; j < matrix.GetLength(1); j++)
- sumSecondRow += matrix[rowIndex, j];
- for (int i = 0; i < matrix.GetLength(0); i++)
- productFirstColumn *= matrix[i, columnIndex];
- Console.WriteLine("Исходная матрица:");
- for (int i = 0; i < matrix.GetLength(0); i++)
- {
- for (int j = 0; j < matrix.GetLength(1); j++)
- {
- Console.Write(matrix[i, j] + "\t");
- }
- Console.WriteLine();
- }
- Console.WriteLine($"\nСумма {rowIndex + 1} строки: {sumSecondRow}");
- Console.WriteLine($"Произведение {columnIndex + 1} столбца: {productFirstColumn}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement