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 numberLine = 1;
- int numberColumn = 0;
- int[,] userArray = {
- { 1, 2, 3, 10},
- { 4, 5, 6, 11},
- { 7, 8, 9, 12 }
- };
- Console.WriteLine("Исходная матрица:");
- for (int x = 0; x < userArray.GetLength(0); x++)
- {
- for (int y = 0; y < userArray.GetLength(1); y++)
- {
- Console.Write(userArray[x, y] + "\t");
- }
- Console.WriteLine();
- }
- for (int x = 0; x < userArray.GetLength(1); x++)
- {
- sumSecondRow += userArray[numberLine, x];
- }
- for (int y = 0; y < userArray.GetLength(0); y++)
- {
- productFirstColumn *= userArray[y, numberColumn];
- }
- Console.WriteLine($"Сумма второй строки = {sumSecondRow}");
- Console.WriteLine($"Произведение первого столбца = {productFirstColumn}");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement