Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Tasks
- {
- class Program
- {
- static void Main(string[] args)
- {
- int secondLineSum = 0;
- int firstColumnMultiply = 1;
- int[,] array = {
- {1, 2, 3, 4},
- {5, 6, 7, 8},
- {9, 1, 2, 3},
- {4, 5, 6, 7} };
- Console.WriteLine("Исходная матрица выглядить так:");
- Console.WriteLine(" ");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine(" ");
- Console.WriteLine("Введите номер строки :");
- int LineNumber = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < array.GetLength(0); i++)
- {
- secondLineSum += array[LineNumber - 1, i];
- }
- Console.WriteLine("Сумма чисел во второй строке равна: " + secondLineSum);
- Console.WriteLine(" ");
- Console.WriteLine("Введите номер столбца :");
- int columnNumber = Convert.ToInt32(Console.ReadLine());
- for (int j = 0; j < array.GetLength(0); j++)
- {
- firstColumnMultiply *= array[j, columnNumber - 1];
- }
- Console.WriteLine("Произведение чисел в первом столбце равно: " + firstColumnMultiply);
- }
- }
- }
Add Comment
Please, Sign In to add comment