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