Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp20
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[,] numbers = {
- { 1, 2, 3 },
- { 4, 5, 6 },
- { 7, 8, 9 } };
- int correction = 1;
- int lineSum = 0;
- int columnMultiplication = 1;
- int matrixLine = 2;
- int matrixColumn = 1;
- for (int i = 0; i < numbers.GetLength(0); i++)
- {
- for (int j = 0; j < numbers.GetLength(1); j++)
- {
- Console.Write(numbers[i, j] + " ");
- }
- Console.WriteLine();
- }
- for (int i = 0; i < numbers.GetLength(1); i++)
- {
- lineSum += numbers[matrixLine - correction, i];
- }
- for (int i = 0; i < numbers.GetLength(0); i++)
- {
- columnMultiplication *= numbers[i, matrixColumn - correction];
- }
- Console.WriteLine($"Сумма {matrixLine} строки - {lineSum}, произведение {matrixColumn} столбца - {columnMultiplication}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment