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