Advertisement
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 Работа_с_конкретными_столбцами_и_строками
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = { { 6, 7, 3, 3 }, { 1, 9, 4, 3 }, { 7, 4, 7, 8 } };
- int sumSecondRow = 0;
- int productFirstColumn = 1;
- 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();
- }
- for (int i = 0; i < array.GetLength(1); i++)
- {
- sumSecondRow += array[1, i];
- }
- for (int i = 0; i < array.GetLength(0); i++)
- {
- productFirstColumn *= array[i, 0];
- }
- Console.WriteLine("Сумма второй строки матрицы: " + sumSecondRow);
- Console.WriteLine("Произведение первого столбца матрицы: " + productFirstColumn);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement