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 getLineNumber = Convert.ToInt32(Console.ReadLine());
- for (int k = 0; k < array.GetLength(0); k++)
- {
- secondLineSum += array[getLineNumber - 1, k];
- }
- Console.WriteLine("Сумма чисел во второй строке равна: " + secondLineSum);
- Console.WriteLine(" ");
- Console.WriteLine("Введите номер столбца :");
- int getColumnNumber = Convert.ToInt32(Console.ReadLine());
- for (int v = 0; v < array.GetLength(0); v++)
- {
- firstColumnMultiply *= array[v, getColumnNumber - 1];
- }
- Console.WriteLine("Произведение чисел в первом столбце равно: " + firstColumnMultiply);
- }
- }
- }
Add Comment
Please, Sign In to add comment