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 Les3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Title = "3.3 Матрица";
- int[,] arrMatrix = {
- { 1, 2, 3 },
- { 4, 5, 6 },
- { 7, 8 ,9 }
- };
- int iCalc1 = 0;
- for(int i = 0; i < arrMatrix.GetLength(1); i++)
- {
- iCalc1 += arrMatrix[1, i];
- }
- int iCalc2 = 1;
- for (int i = 0; i < arrMatrix.GetLength(0); i++)
- {
- iCalc2 *= arrMatrix[i, 0];
- }
- Console.SetCursorPosition(0, 0);
- for (int i = 0; i < arrMatrix.GetLength(0); i++)
- {
- for (int j = 0; j < arrMatrix.GetLength(1); j++)
- {
- Console.Write(arrMatrix[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine($"Сумма элементов второй строки: {iCalc1}");
- Console.WriteLine($"Произведение элементов второй строки: {iCalc2}");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement