Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Homework1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = {
- { 1, 3, 21, 15 },
- { 4, 12, 7, 5 },
- { 5, 24, 2, 1 } };
- int rowSum = 0;
- int colComposition = 1;
- for (int i = 0; i < array.GetLength(1); i++)
- {
- rowSum += array[1, i];
- }
- for (int j = 0; j < array.GetLength(0); j++)
- {
- colComposition *= array[j, 0];
- }
- Console.WriteLine(rowSum + " - сумма второй строки. " + colComposition + " - произведние первого столбца");
- Console.SetCursorPosition(12, 2);
- 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();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment